summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/ContinuationIndenter.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-03-12 08:24:47 +0000
committerDaniel Jasper <djasper@google.com>2014-03-12 08:24:47 +0000
commitda353cd5f1c4c281c2c5bde7d3b62c749bb91069 (patch)
tree7b4285031cc3f955347fbabf80579a9d72eff01c /clang/lib/Format/ContinuationIndenter.cpp
parent1da3512166367207be4a025785abfec84bd3fa44 (diff)
downloadbcm5719-llvm-da353cd5f1c4c281c2c5bde7d3b62c749bb91069.tar.gz
bcm5719-llvm-da353cd5f1c4c281c2c5bde7d3b62c749bb91069.zip
clang-format: Fix crasher.
Caused by unknown tokens (e.g. "\n") not properly updating the state. Example: const char* c = STRINGIFY( \na : b); llvm-svn: 203645
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index a96f1680db7..17af2fa5f25 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -227,8 +227,8 @@ unsigned ContinuationIndenter::addTokenToState(LineState &State, bool Newline,
State.NextToken->WhitespaceRange.getEnd()) -
SourceMgr.getSpellingColumnNumber(
State.NextToken->WhitespaceRange.getBegin());
- State.Column += WhitespaceLength + State.NextToken->ColumnWidth;
- State.NextToken = State.NextToken->Next;
+ State.Column += WhitespaceLength;
+ moveStateToNextToken(State, DryRun, /*NewLine=*/false);
return 0;
}
@@ -349,7 +349,6 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State,
Penalty += State.NextToken->SplitPenalty;
-
// Breaking before the first "<<" is generally not desirable if the LHS is
// short. Also always add the penalty if the LHS is split over mutliple lines
// to avoid unncessary line breaks that just work around this penalty.
OpenPOWER on IntegriCloud