summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp1
-rw-r--r--clang/unittests/Format/FormatTest.cpp1
2 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index df6bfd37ae0..91aeb73e552 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -683,6 +683,7 @@ private:
TT_TrailingReturnArrow))
CurrentToken->Type = TT_Unknown;
CurrentToken->Role.reset();
+ CurrentToken->MatchingParen = nullptr;
CurrentToken->FakeLParens.clear();
CurrentToken->FakeRParens = 0;
}
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 3aa53465d35..bb8f5bc0b82 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -2612,6 +2612,7 @@ TEST_F(FormatTest, MacroDefinitionsWithIncompleteCode) {
verifyFormat("#if \"a");
verifyNoCrash("#if a\na(\n#else\n#endif\n{a");
+ verifyNoCrash("a={0,1\n#if a\n#else\n;\n#endif\n}");
}
TEST_F(FormatTest, MacrosWithoutTrailingSemicolon) {
OpenPOWER on IntegriCloud