diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2015-05-28 19:55:49 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2015-05-28 19:55:49 +0000 |
| commit | ddf1cda2c222344dc42125b4f5295189620ab0df (patch) | |
| tree | 8d04f2b8676bf8ef2153ae9104ddf0beae1ca4eb | |
| parent | b32552faf62ca9a4cfde5dd2ca18651debaa0e55 (diff) | |
| download | bcm5719-llvm-ddf1cda2c222344dc42125b4f5295189620ab0df.tar.gz bcm5719-llvm-ddf1cda2c222344dc42125b4f5295189620ab0df.zip | |
[Format] Skip creating temporary std::strings when filling another string.
No functional change intended.
llvm-svn: 238466
| -rw-r--r-- | clang/lib/Format/WhitespaceManager.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp index 4baaab1c987..65395277f89 100644 --- a/clang/lib/Format/WhitespaceManager.cpp +++ b/clang/lib/Format/WhitespaceManager.cpp @@ -402,7 +402,7 @@ void WhitespaceManager::appendNewlineText(std::string &Text, unsigned Newlines, unsigned Offset = std::min<int>(EscapedNewlineColumn - 1, PreviousEndOfTokenColumn); for (unsigned i = 0; i < Newlines; ++i) { - Text.append(std::string(EscapedNewlineColumn - Offset - 1, ' ')); + Text.append(EscapedNewlineColumn - Offset - 1, ' '); Text.append(UseCRLF ? "\\\r\n" : "\\\n"); Offset = 0; } @@ -414,7 +414,7 @@ void WhitespaceManager::appendIndentText(std::string &Text, unsigned WhitespaceStartColumn) { switch (Style.UseTab) { case FormatStyle::UT_Never: - Text.append(std::string(Spaces, ' ')); + Text.append(Spaces, ' '); break; case FormatStyle::UT_Always: { unsigned FirstTabWidth = @@ -424,8 +424,8 @@ void WhitespaceManager::appendIndentText(std::string &Text, Spaces -= FirstTabWidth; Text.append("\t"); } - Text.append(std::string(Spaces / Style.TabWidth, '\t')); - Text.append(std::string(Spaces % Style.TabWidth, ' ')); + Text.append(Spaces / Style.TabWidth, '\t'); + Text.append(Spaces % Style.TabWidth, ' '); break; } case FormatStyle::UT_ForIndentation: @@ -436,10 +436,10 @@ void WhitespaceManager::appendIndentText(std::string &Text, if (Indentation > Spaces) Indentation = Spaces; unsigned Tabs = Indentation / Style.TabWidth; - Text.append(std::string(Tabs, '\t')); + Text.append(Tabs, '\t'); Spaces -= Tabs * Style.TabWidth; } - Text.append(std::string(Spaces, ' ')); + Text.append(Spaces, ' '); break; } } |

