diff options
author | Alexander Kornienko <alexfh@google.com> | 2014-04-15 14:52:43 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2014-04-15 14:52:43 +0000 |
commit | 64a42b8dd25855ec4e4cb94ed4e51f58b911c358 (patch) | |
tree | d9f094ca2cd1f13b34c0b07b5a35d445e0814294 /clang/lib/Format/ContinuationIndenter.cpp | |
parent | eec6fa541c460bacf386b4242c846f5011dcd51d (diff) | |
download | bcm5719-llvm-64a42b8dd25855ec4e4cb94ed4e51f58b911c358.tar.gz bcm5719-llvm-64a42b8dd25855ec4e4cb94ed4e51f58b911c358.zip |
Fix assertion when breaking string literals with tab characters.
Summary: Fixes http://llvm.org/PR19368
Reviewers: djasper, klimek
Reviewed By: klimek
CC: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D3379
llvm-svn: 206295
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 35dc182a2d1..9311ca481c3 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -961,6 +961,12 @@ unsigned ContinuationIndenter::breakProtrudingToken(const FormatToken &Current, break; } + // When breaking before a tab character, it may be moved by a few columns, + // but will still be expanded to the next tab stop, so we don't save any + // columns. + if (NewRemainingTokenColumns == RemainingTokenColumns) + break; + assert(NewRemainingTokenColumns < RemainingTokenColumns); if (!DryRun) Token->insertBreak(LineIndex, TailOffset, Split, Whitespaces); |