aboutsummaryrefslogtreecommitdiff
path: root/lib/Format
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2013-03-28 18:40:55 +0000
committerAlexander Kornienko <alexfh@google.com>2013-03-28 18:40:55 +0000
commit9fdc00a237fe19b892f22780321ddfd1a3691d61 (patch)
tree0a9bbb21f6f5324cc394d90e85600f86ca8a35ef /lib/Format
parent03852c8717b45ece934f7740a100de526a734641 (diff)
Fixed handling of comments before preprocessor directives.
Comments before preprocessor directives used to be stored with InPPDirective flag set, which prevented correct comment splitting in this case. Fixed by flushing comments before switching on InPPDirective. Added a new test and fixed one of the existing tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178261 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format')
-rw-r--r--lib/Format/UnwrappedLineParser.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp
index 8408ce3a0d..b24d5141e0 100644
--- a/lib/Format/UnwrappedLineParser.cpp
+++ b/lib/Format/UnwrappedLineParser.cpp
@@ -822,6 +822,7 @@ void UnwrappedLineParser::readToken() {
while (!Line->InPPDirective && FormatTok.Tok.is(tok::hash) &&
((FormatTok.NewlinesBefore > 0 && FormatTok.HasUnescapedNewline) ||
FormatTok.IsFirst)) {
+ flushComments(FormatTok.NewlinesBefore > 0);
// If there is an unfinished unwrapped line, we flush the preprocessor
// directives only after that unwrapped line was finished later.
bool SwitchToPreprocessorLines =