diff options
author | Manuel Klimek <klimek@google.com> | 2013-01-07 09:24:17 +0000 |
---|---|---|
committer | Manuel Klimek <klimek@google.com> | 2013-01-07 09:24:17 +0000 |
commit | d544c574ccbcbfcb5b3c3edd19956143826008cf (patch) | |
tree | f0ae6671f751d5efe12dd0a53324157fd8d105b4 /lib/Format/Format.cpp | |
parent | 6cf581436e9e59a18f6a362027a69eaaa9b67597 (diff) |
Do not ever allow using the full line in preprocessor directives.
We would format:
#define A \
int f(a); int i;
as
#define A \
int f(a);\
int i
The fix will break up macro definitions that could fit a line, but hit
the last column; fixing that is more involved, though, as it requires
looking at the following line.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171715 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r-- | lib/Format/Format.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 35c1e403c6..7b3c575d0b 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -137,7 +137,7 @@ public: // FIXME: We need to check whether we're in a preprocessor directive, even // if all tokens fit - the next line might be a preprocessor directive, // too, in which case we need to account for the possible escaped newline. - if (Columns > Style.ColumnLimit || + if (Columns > Style.ColumnLimit - (Line.InPPDirective ? 1 : 0) || (Annotations[i].MustBreakBefore && Annotations[i].Type != TokenAnnotation::TT_CtorInitializerColon)) { FitsOnALine = false; |