forked from OSchip/llvm-project
clang-format: Fix crasher caused by incorrect resetting of token info.
llvm-svn: 226685
This commit is contained in:
parent
1292e24d0e
commit
04b979dd81
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue