diff options
author | Daniel Jasper <djasper@google.com> | 2014-06-10 10:42:26 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2014-06-10 10:42:26 +0000 |
commit | 908180574e6d09eba543b77e76b01c06865c78ff (patch) | |
tree | da0be6baaa6926470afcd7483f6b5d84fe2cdf92 /clang/lib/Format/ContinuationIndenter.cpp | |
parent | 9d63b5eb7f00f8072b74fd701fc89f5060d7aff9 (diff) | |
download | bcm5719-llvm-908180574e6d09eba543b77e76b01c06865c78ff.tar.gz bcm5719-llvm-908180574e6d09eba543b77e76b01c06865c78ff.zip |
clang-format: Fix enum formatting with specific comment.
Before:
enum Fruit { //
APPLE,
PEAR };
After:
enum Fruit { //
APPLE,
PEAR
};
llvm-svn: 210522
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 5d59f19edfb..6304ff71fcd 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -447,7 +447,9 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State, // If we break after { or the [ of an array initializer, we should also break // before the corresponding } or ]. - if (Previous.is(tok::l_brace) || Previous.Type == TT_ArrayInitializerLSquare) + if (PreviousNonComment && + (PreviousNonComment->is(tok::l_brace) || + PreviousNonComment->Type == TT_ArrayInitializerLSquare)) State.Stack.back().BreakBeforeClosingBrace = true; if (State.Stack.back().AvoidBinPacking) { |