Clion 中开启 clang-format Preferences -> Editor -> Code Style -> “Enable ClangFormat” 在保存时自动代码格式化 Preferences -> Tools -> Actions on Save -> Reformat code