5

I've tried the Visual Studio plugin but you have to select the code you want to apply clang to and then call the formatter. So CTRL+A CTRL+R CTRL+F for each and every file.

Is there a way to do that for the whole project and/or whole solution without manually going through each file?

Jon Cage
  • 36,366
  • 38
  • 137
  • 215
  • Does this answer your question? [How to call clang-format over a cpp project folder?](https://stackoverflow.com/questions/28896909/how-to-call-clang-format-over-a-cpp-project-folder) – parsley72 Apr 27 '23 at 02:41

2 Answers2

0

I don't know of a way to do this by reference to a Visual Studio project, but this should be possible by calling clang-format from the command line to format everything in the folder:

clang-format style=llvm *.h *.cpp

More information here.

Jack Deeth
  • 3,062
  • 3
  • 24
  • 39
-1

Example: clang-format -i **/*.cc **/*.h

Adapt to the file format of your project files, like replacing cc with cpp

Yukun Xia
  • 65
  • 7