Before, this wasn't formatted properly:
enum ::C f() {
return a;
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240021
91177308-0d34-0410-b5e6-
96231b3b80d8
while (FormatTok->Tok.getIdentifierInfo() ||
FormatTok->isOneOf(tok::colon, tok::coloncolon, tok::less,
tok::greater, tok::comma, tok::question)) {
+ if (FormatTok->is(tok::coloncolon))
+ nextToken();
nextToken();
// We can have macros or attributes in between 'enum' and the enum name.
if (FormatTok->is(tok::l_paren))
verifyFormat("enum X E {} d;");
verifyFormat("enum __attribute__((...)) E {} d;");
verifyFormat("enum __declspec__((...)) E {} d;");
- verifyFormat("enum X f() {\n a();\n return 42;\n}");
verifyFormat("enum {\n"
" Bar = Foo<int, int>::value\n"
"};",
" TWO\n"
"};\n"
"int i;");
+ // Not enums.
+ verifyFormat("enum X f() {\n"
+ " a();\n"
+ " return 42;\n"
+ "}");
+ verifyFormat("enum ::X f() {\n"
+ " a();\n"
+ " return 42;\n"
+ "}");
+ verifyFormat("enum ns::X f() {\n"
+ " a();\n"
+ " return 42;\n"
+ "}");
}
TEST_F(FormatTest, FormatsEnumsWithErrors) {