From: Daniel Jasper Date: Tue, 5 Feb 2013 09:34:14 +0000 (+0000) Subject: Fix formatting regression introduced by r174307. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5b7e7b0ec77f49c1b24deffc9b7032ca16ca9f0d;p=clang Fix formatting regression introduced by r174307. In preprocessor definitions, we would not parse all the tokens and thus not annotate them anymore. This led to a wrong formatting of comments in google style: #endif // HEADER_GUARD -- requires two spaces git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174361 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp index 34bccb978e..f34bc89cfb 100644 --- a/lib/Format/TokenAnnotator.cpp +++ b/lib/Format/TokenAnnotator.cpp @@ -423,6 +423,8 @@ public: default: break; } + while (CurrentToken != NULL) + next(); } LineType parseLine() { diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 5b99716fdc..f5606cb529 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -479,6 +479,8 @@ TEST_F(FormatTest, UnderstandsSingleLineComments) { verifyFormat("someFunction(anotherFunction( // Force break.\n" " parameter));"); + + verifyGoogleFormat("#endif // HEADER_GUARD"); } TEST_F(FormatTest, UnderstandsMultiLineComments) {