I got confused by that too. When they tell you to use the flag -style=file
they literally mean for you to type out -style=file
, NOT -style=<path/to/actual/filename>
.
With this flag, clang-format
will look for a file called .clang-format
in the directory of the target file. If it doesn’t find any it will cd ..
and try again. There doesn’t seem to be a way to tell clang-format
to use a file that is not named exactly .clang-format
.
The correct usage for your example would be:
./clang-format -style=llvm -dump-config > ~/.clang-format
./clang-format -style=file ~/myFile.cc