clang-format: Fix crasher caused by incorrect resetting of token info.
authorDaniel Jasper <djasper@google.com>
Wed, 21 Jan 2015 18:35:47 +0000 (18:35 +0000)
committerDaniel Jasper <djasper@google.com>
Wed, 21 Jan 2015 18:35:47 +0000 (18:35 +0000)
llvm-svn: 226685

clang/lib/Format/TokenAnnotator.h
clang/unittests/Format/FormatTest.cpp

index 8aa163a..f9e1efa 100644 (file)
@@ -75,6 +75,7 @@ public:
     FormatToken *Current = First;
     while (Current) {
       Current->Children.clear();
+      Current->Role.reset();
       Current = Current->Next;
     }
   }
index bb8f5bc..553368d 100644 (file)
@@ -2613,6 +2613,7 @@ TEST_F(FormatTest, MacroDefinitionsWithIncompleteCode) {
 
   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) {