【发布时间】:2018-11-14 08:58:20
【问题描述】:
我有一个类似的 cpp 代码:
#include<bits/stdc++.h>
using namespace std;
namespace a {
const int b=1;
}
int main() {
cout << "hello" << endl;
return 0;
}
我尝试了以下.clang-format的配置
Language: Cpp
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: false
AfterStruct: true
BeforeCatch: false
BeforeElse: false
FixNamespaceComments: true # add commend at end:
NamespaceIndentation: All #intend content of namespace
预期的输出包括命名空间右括号 // namespace a 末尾的注释。
但如果命名空间中只有 int a 则不会显示。
当我尝试在命名空间中再添加一个变量时,它工作正常。
我正在使用 clang-format-6.0
【问题讨论】:
-
这也发生在我身上。也许这是只有一条语句的命名空间的预期结果?
标签: c++ clang-format