r174361 - Fix formatting regression introduced by r174307.
Daniel Jasper
djasper at google.com
Tue Feb 5 01:34:15 PST 2013
Author: djasper
Date: Tue Feb 5 03:34:14 2013
New Revision: 174361
URL: http://llvm.org/viewvc/llvm-project?rev=174361&view=rev
Log:
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
Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=174361&r1=174360&r2=174361&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Tue Feb 5 03:34:14 2013
@@ -423,6 +423,8 @@ public:
default:
break;
}
+ while (CurrentToken != NULL)
+ next();
}
LineType parseLine() {
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=174361&r1=174360&r2=174361&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Tue Feb 5 03:34:14 2013
@@ -479,6 +479,8 @@ TEST_F(FormatTest, UnderstandsSingleLine
verifyFormat("someFunction(anotherFunction( // Force break.\n"
" parameter));");
+
+ verifyGoogleFormat("#endif // HEADER_GUARD");
}
TEST_F(FormatTest, UnderstandsMultiLineComments) {
More information about the cfe-commits
mailing list