Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to use clang-format

📅 2020-Mar-22 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ clang ⬩ 📚 Archive

clang-format is a tool that can be used to format C++ code to match a coding style.

$ sudo apt install clang-format
$ clang-format foobar.cpp

This formats the lines in the input file and spits out the formatted lines to stdout.

$ clang-format -i foobar.cpp
$ clang-format -style=file foobar.cpp