summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Format/TokenAnnotator.h1
-rw-r--r--clang/unittests/Format/FormatTest.cpp7
2 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.h b/clang/lib/Format/TokenAnnotator.h
index e51003bac82..ca8b1154157 100644
--- a/clang/lib/Format/TokenAnnotator.h
+++ b/clang/lib/Format/TokenAnnotator.h
@@ -56,6 +56,7 @@ public:
Current->Next = I->Tok;
I->Tok->Previous = Current;
Current = Current->Next;
+ Current->Children.clear();
for (SmallVectorImpl<UnwrappedLine>::const_iterator
I = Node.Children.begin(),
E = Node.Children.end();
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 9b24f040d16..431940938dc 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -2333,6 +2333,13 @@ TEST_F(FormatTest, LayoutStatementsAroundPreprocessorDirectives) {
"#if 1\n"
"#else\n"
"#endif\n");
+ verifyFormat("DEBUG({\n"
+ " return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;\n"
+ "});\n"
+ "#if a\n"
+ "#else\n"
+ "#endif");
}
TEST_F(FormatTest, FormatsJoinedLinesOnSubsequentRuns) {
OpenPOWER on IntegriCloud