diff options
| author | Daniel Jasper <djasper@google.com> | 2015-05-06 15:19:47 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2015-05-06 15:19:47 +0000 |
| commit | 1fe0d5ca59ab2e23fc5b9755d83268f649080c61 (patch) | |
| tree | 0bb4b27b5629d8503a7166fbff43a38e9cef87ba /clang/lib | |
| parent | 112b50e6b627f4780656a4f62f446848e46197b9 (diff) | |
| download | bcm5719-llvm-1fe0d5ca59ab2e23fc5b9755d83268f649080c61.tar.gz bcm5719-llvm-1fe0d5ca59ab2e23fc5b9755d83268f649080c61.zip | |
clang-format: Merge labels and subsequent semicolons.
E.g.:
default:;
This can be used to get around restrictions as to what can follow a
label. It fixes llvm.org/PR19648.
llvm-svn: 236604
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 793746137a5..9f034eca379 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1896,7 +1896,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, return false; if (Right.is(tok::colon)) { if (Line.First->isOneOf(tok::kw_case, tok::kw_default) || - !Right.getNextNonComment()) + !Right.getNextNonComment() || Right.getNextNonComment()->is(tok::semi)) return false; if (Right.is(TT_ObjCMethodExpr)) return false; diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 94619116481..117e83802c8 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -1381,6 +1381,8 @@ void UnwrappedLineParser::parseLabel() { } addUnwrappedLine(); } else { + if (FormatTok->is(tok::semi)) + nextToken(); addUnwrappedLine(); } Line->Level = OldLineLevel; |

