r226685 - clang-format: Fix crasher caused by incorrect resetting of token info.
Daniel Jasper
djasper at google.com
Wed Jan 21 10:35:47 PST 2015
Author: djasper
Date: Wed Jan 21 12:35:47 2015
New Revision: 226685
URL: http://llvm.org/viewvc/llvm-project?rev=226685&view=rev
Log:
clang-format: Fix crasher caused by incorrect resetting of token info.
Modified:
cfe/trunk/lib/Format/TokenAnnotator.h
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/TokenAnnotator.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.h?rev=226685&r1=226684&r2=226685&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.h (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.h Wed Jan 21 12:35:47 2015
@@ -75,6 +75,7 @@ public:
FormatToken *Current = First;
while (Current) {
Current->Children.clear();
+ Current->Role.reset();
Current = Current->Next;
}
}
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=226685&r1=226684&r2=226685&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Wed Jan 21 12:35:47 2015
@@ -2613,6 +2613,7 @@ TEST_F(FormatTest, MacroDefinitionsWithI
verifyNoCrash("#if a\na(\n#else\n#endif\n{a");
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) {
More information about the cfe-commits
mailing list