c++clangclang-format

How to call clang-format over a cpp project folder?


Is there a way to call something like clang-format --style=Webkit for an entire cpp project folder, rather than running it separately for each file?

I am using clang-format.py and vim to do this, but I assume there is a way to apply this once.


Solution

  • What about:

    clang-format -i -style=WebKit *.cpp *.h
    

    in the project folder. The -i option makes it inplace (by default formatted output is written to stdout).