summaryrefslogtreecommitdiffstats
path: root/lib/Format/UnwrappedLineFormatter.cpp
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2018-03-27 13:14:29 +0000
committerKrasimir Georgiev <krasimir@google.com>2018-03-27 13:14:29 +0000
commitfca35ec59e419705c4e6265811fdc850cbe362ab (patch)
tree548e4093bd37d818236604e086ec1b0d4155900b /lib/Format/UnwrappedLineFormatter.cpp
parent3caa3303cad1654228233a859513cec9e9642e74 (diff)
Revert "[clang-format] Remove empty lines before }[;] // comment"
This reverts commit r327861. The empty line before namespaces is desired in some places. We need a better approach to handle this. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328621 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/UnwrappedLineFormatter.cpp')
-rw-r--r--lib/Format/UnwrappedLineFormatter.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/Format/UnwrappedLineFormatter.cpp b/lib/Format/UnwrappedLineFormatter.cpp
index b0da0028bf..2ce39fb04c 100644
--- a/lib/Format/UnwrappedLineFormatter.cpp
+++ b/lib/Format/UnwrappedLineFormatter.cpp
@@ -1133,12 +1133,8 @@ void UnwrappedLineFormatter::formatFirstToken(const AnnotatedLine &Line,
std::min(RootToken.NewlinesBefore, Style.MaxEmptyLinesToKeep + 1);
// Remove empty lines before "}" where applicable.
if (RootToken.is(tok::r_brace) &&
- // Look for "}", "} // comment", "};" or "}; // comment".
(!RootToken.Next ||
- (RootToken.Next->is(tok::comment) && !RootToken.Next->Next) ||
- (RootToken.Next->is(tok::semi) &&
- (!RootToken.Next->Next || (RootToken.Next->Next->is(tok::comment) &&
- !RootToken.Next->Next->Next)))))
+ (RootToken.Next->is(tok::semi) && !RootToken.Next->Next)))
Newlines = std::min(Newlines, 1u);
// Remove empty lines at the start of nested blocks (lambdas/arrow functions)
if (PreviousLine == nullptr && Line.Level > 0)