diff options
author | Alexander Kornienko <alexfh@google.com> | 2013-03-28 18:40:55 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2013-03-28 18:40:55 +0000 |
commit | efd98385c075ac1cb60700132e8f98df10663043 (patch) | |
tree | 4ac453ba7f093dfa52238df9bc4b5d03d1112990 /clang/lib | |
parent | 52d988650035cc57a6ad8aca764c17bec50974f5 (diff) | |
download | bcm5719-llvm-efd98385c075ac1cb60700132e8f98df10663043.tar.gz bcm5719-llvm-efd98385c075ac1cb60700132e8f98df10663043.zip |
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.
llvm-svn: 178261
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 8408ce3a0d8..b24d5141e0a 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/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 = |