diff options
author | Daniel Jasper <djasper@google.com> | 2013-08-23 10:05:49 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-08-23 10:05:49 +0000 |
commit | f93551c8b187f90624426543e95489b71c014118 (patch) | |
tree | 39d34edfe5836e9932ef1461f5d703e535675d87 /clang/lib/Format/ContinuationIndenter.cpp | |
parent | bff06ce221671ce0cec97b7677967a3dacf93359 (diff) | |
download | bcm5719-llvm-f93551c8b187f90624426543e95489b71c014118.tar.gz bcm5719-llvm-f93551c8b187f90624426543e95489b71c014118.zip |
clang-format: Handle trailing commas in column layout of braced list.
Before, this was causing errors.
Also exit early in breakProtrudingToken() (before the expensive call to
SourceManager::getSpellingColumnNumber()). This makes formatting huge
(100k+-item) braced lists possible.
llvm-svn: 189094
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 8f7bb50060e..005eec82b7b 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -569,6 +569,9 @@ unsigned ContinuationIndenter::moveStateToNextToken(LineState &State, unsigned ContinuationIndenter::breakProtrudingToken(const FormatToken &Current, LineState &State, bool DryRun) { + if (!Current.isOneOf(tok::string_literal, tok::comment)) + return 0; + llvm::OwningPtr<BreakableToken> Token; unsigned StartColumn = State.Column - Current.CodePointCount; unsigned OriginalStartColumn = |