diff options
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 6027f5fd612..9d19262397a 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -1454,7 +1454,13 @@ unsigned ContinuationIndenter::reformatRawStringLiteral( unsigned RawLastLineEndColumn = getLastLineEndColumn( *NewCode, FirstStartColumn, Style.TabWidth, Encoding); State.Column = RawLastLineEndColumn + NewSuffixSize; - return Fixes.second; + // Since we're updating the column to after the raw string literal here, we + // have to manually add the penalty for the prefix R"delim( over the column + // limit. + unsigned PrefixExcessCharacters = + StartColumn + NewPrefixSize > Style.ColumnLimit ? + StartColumn + NewPrefixSize - Style.ColumnLimit : 0; + return Fixes.second + PrefixExcessCharacters * Style.PenaltyExcessCharacter; } unsigned ContinuationIndenter::addMultilineToken(const FormatToken &Current, |