aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-01-18 14:46:43 +0000
committerManuel Klimek <klimek@google.com>2013-01-18 14:46:43 +0000
commit4c1281283513ff5cd37ee224639e2f3853ec9ea8 (patch)
treec2c126f2e9c45135c28e5ee806e466d0cf8cebb0 /lib/Format/Format.cpp
parentea8bca7679d8e5129ad4b49758a43843d1d0dbe0 (diff)
Fixes issues around pulling in the next line in simple if statements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172822 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 1821937ec3..d234006a25 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -1749,6 +1749,10 @@ private:
unsigned Limit) {
if (!Style.AllowShortIfStatementsOnASingleLine)
return;
+ if ((I + 1)->InPPDirective != I->InPPDirective ||
+ ((I + 1)->InPPDirective &&
+ (I + 1)->First.FormatTok.HasUnescapedNewline))
+ return;
AnnotatedLine &Line = *I;
if (Line.Last->isNot(tok::r_paren))
return;