clang-format: Fix crasher caused by incorrect resetting of token info.

llvm-svn: 226685
This commit is contained in:
Daniel Jasper 2015-01-21 18:35:47 +00:00
parent 1292e24d0e
commit 04b979dd81
2 changed files with 2 additions and 0 deletions

View File

@ -75,6 +75,7 @@ public:
FormatToken *Current = First; FormatToken *Current = First;
while (Current) { while (Current) {
Current->Children.clear(); Current->Children.clear();
Current->Role.reset();
Current = Current->Next; Current = Current->Next;
} }
} }

View File

@ -2613,6 +2613,7 @@ TEST_F(FormatTest, MacroDefinitionsWithIncompleteCode) {
verifyNoCrash("#if a\na(\n#else\n#endif\n{a"); verifyNoCrash("#if a\na(\n#else\n#endif\n{a");
verifyNoCrash("a={0,1\n#if a\n#else\n;\n#endif\n}"); verifyNoCrash("a={0,1\n#if a\n#else\n;\n#endif\n}");
verifyNoCrash("#if a\na(\n#else\n#endif\n) a {a,b,c,d,f,g};");
} }
TEST_F(FormatTest, MacrosWithoutTrailingSemicolon) { TEST_F(FormatTest, MacrosWithoutTrailingSemicolon) {