我的项目目录中有一个包含.cpp文件和构建目录的.clang-format。在我的终端上,我cd进入我的项目文件夹并运行clang-format -style=file -i *.cpp。这是我的.clang-format文件。
Language: Cpp
ColumnLimit: 0
BreakBeforeBraces: GNU
BreakConstructorInitializers: AfterColon
Cpp11BracedListStyle: true
IndentCaseLabels: true
NamespaceIndentation: All
IndentWidth: 4
TabWidth: 4
UseTab: Never
DerivePointerAlignment: false
PointerAlignment: Left
IncludeBlocks: Regroup我正在通过更改BreakBeforeBraces来测试功能,但没有任何变化。它似乎使用了一种备用格式。到底怎么回事?有没有办法了解clang-format到底在做什么?
发布于 2019-09-16 23:54:46
使用-style=file时,每个输入文件的clang-format将尝试查找位于输入文件的最近父目录中的.clang-format文件。当使用标准输入时,将从当前目录开始搜索。
您可以使用以下命令查看运行目录中使用的实际配置
clang-format -style=file -dump-confighttps://stackoverflow.com/questions/57959505
复制相似问题