]> granicus.if.org Git - clang/commitdiff
Fix formatting regression introduced by r174307.
authorDaniel Jasper <djasper@google.com>
Tue, 5 Feb 2013 09:34:14 +0000 (09:34 +0000)
committerDaniel Jasper <djasper@google.com>
Tue, 5 Feb 2013 09:34:14 +0000 (09:34 +0000)
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

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

index 34bccb978e7873374397c024ba8ca9aef4826d32..f34bc89cfb9f23f7e011d1dd302408fde67189c6 100644 (file)
@@ -423,6 +423,8 @@ public:
     default:
       break;
     }
+    while (CurrentToken != NULL)
+      next();
   }
 
   LineType parseLine() {
index 5b99716fdca08fa747fd22c0eb02230046f79ec5..f5606cb52901eb2414772e47acd06420c059d03a 100644 (file)
@@ -479,6 +479,8 @@ TEST_F(FormatTest, UnderstandsSingleLineComments) {
 
   verifyFormat("someFunction(anotherFunction( // Force break.\n"
                "    parameter));");
+
+  verifyGoogleFormat("#endif  // HEADER_GUARD");
 }
 
 TEST_F(FormatTest, UnderstandsMultiLineComments) {