diff options
author | Daniel Jasper <djasper@google.com> | 2015-03-09 08:13:55 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-03-09 08:13:55 +0000 |
commit | ac5c97e36b589926d6883cf4a246ec2ba94d35ee (patch) | |
tree | 0c2f55a3ca16eb6fd46d17875028a6222165e3a4 /clang/lib/Format/UnwrappedLineFormatter.cpp | |
parent | 65b07b8e1b73816dc7f339e2c461f1bc72443319 (diff) | |
download | bcm5719-llvm-ac5c97e36b589926d6883cf4a246ec2ba94d35ee.tar.gz bcm5719-llvm-ac5c97e36b589926d6883cf4a246ec2ba94d35ee.zip |
clang-format: Don't remove newline if macro ends in access specifier.
I.e.:
#define A public:
// The new line before this line would be removed.
int a;
llvm-svn: 231636
Diffstat (limited to 'clang/lib/Format/UnwrappedLineFormatter.cpp')
-rw-r--r-- | clang/lib/Format/UnwrappedLineFormatter.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp index 8e6809f7608..71e8b3fd6b0 100644 --- a/clang/lib/Format/UnwrappedLineFormatter.cpp +++ b/clang/lib/Format/UnwrappedLineFormatter.cpp @@ -512,7 +512,8 @@ void UnwrappedLineFormatter::formatFirstToken(FormatToken &RootToken, ++Newlines; // Remove empty lines after access specifiers. - if (PreviousLine && PreviousLine->First->isAccessSpecifier()) + if (PreviousLine && PreviousLine->First->isAccessSpecifier() && + (!PreviousLine->InPPDirective || !RootToken.HasUnescapedNewline)) Newlines = std::min(1u, Newlines); Whitespaces->replaceWhitespace(RootToken, Newlines, IndentLevel, Indent, |