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

llvm-svn: 174361

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

index 34bccb9..f34bc89 100644 (file)
@@ -423,6 +423,8 @@ public:
     default:
       break;
     }
+    while (CurrentToken != NULL)
+      next();
   }
 
   LineType parseLine() {
index 5b99716..f5606cb 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) {