summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-02-11 12:33:24 +0000
committerManuel Klimek <klimek@google.com>2013-02-11 12:33:24 +0000
commit0c13795f68a3d2fe0bc31650260809ad8f160a3b (patch)
treefd19c182cd4fb1121815f48e829a12f59910d35a /clang/lib/Format/Format.cpp
parente2067788338f887024adc3df824252a03730147a (diff)
downloadbcm5719-llvm-0c13795f68a3d2fe0bc31650260809ad8f160a3b.tar.gz
bcm5719-llvm-0c13795f68a3d2fe0bc31650260809ad8f160a3b.zip
Fixes handling of empty lines in macros.
Now correctly formats: #define A \ \ b; to #define A b; Added the state whether an unwrapped line is a macro to the debug output. llvm-svn: 174878
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r--clang/lib/Format/Format.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 299a8558b97..a78b650dfad 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -804,9 +804,10 @@ public:
// Consume and record whitespace until we find a significant token.
while (FormatTok.Tok.is(tok::unknown)) {
- FormatTok.NewlinesBefore += Text.count('\n');
- FormatTok.HasUnescapedNewline =
- Text.count("\\\n") != FormatTok.NewlinesBefore;
+ unsigned Newlines = Text.count('\n');
+ unsigned EscapedNewlines = Text.count("\\\n");
+ FormatTok.NewlinesBefore += Newlines;
+ FormatTok.HasUnescapedNewline |= EscapedNewlines != Newlines;
FormatTok.WhiteSpaceLength += FormatTok.Tok.getLength();
if (FormatTok.Tok.is(tok::eof))
OpenPOWER on IntegriCloud