diff options
| author | Daniel Jasper <djasper@google.com> | 2015-01-21 18:35:47 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2015-01-21 18:35:47 +0000 |
| commit | 04b979dd812c86f78f58e4d155eebe050de08e4e (patch) | |
| tree | 2e72b751fe5f02a21948d5f2243a56ddbd5d9972 /clang | |
| parent | 1292e24d0e10720b3bac7506398f96c2a2ebed6c (diff) | |
| download | bcm5719-llvm-04b979dd812c86f78f58e4d155eebe050de08e4e.tar.gz bcm5719-llvm-04b979dd812c86f78f58e4d155eebe050de08e4e.zip | |
clang-format: Fix crasher caused by incorrect resetting of token info.
llvm-svn: 226685
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.h | 1 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.h b/clang/lib/Format/TokenAnnotator.h index 8aa163aff61..f9e1efa31b2 100644 --- a/clang/lib/Format/TokenAnnotator.h +++ b/clang/lib/Format/TokenAnnotator.h @@ -75,6 +75,7 @@ public: FormatToken *Current = First; while (Current) { Current->Children.clear(); + Current->Role.reset(); Current = Current->Next; } } diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index bb8f5bc0b82..553368d5633 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -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) { |

