Author: Nathan James Date: 2021-04-12T15:13:59+01:00 New Revision: bcbea2ab84df87983fa9b30e94ea25eda0eb2338
URL: https://github.com/llvm/llvm-project/commit/bcbea2ab84df87983fa9b30e94ea25eda0eb2338 DIFF: https://github.com/llvm/llvm-project/commit/bcbea2ab84df87983fa9b30e94ea25eda0eb2338.diff LOG: [NFC] Remove redundant string copy Added: Modified: clang/include/clang/AST/TextNodeDumper.h Removed: ################################################################################ diff --git a/clang/include/clang/AST/TextNodeDumper.h b/clang/include/clang/AST/TextNodeDumper.h index 15ca348f47667..0955c494a74ad 100644 --- a/clang/include/clang/AST/TextNodeDumper.h +++ b/clang/include/clang/AST/TextNodeDumper.h @@ -69,10 +69,8 @@ class TextTreeStructure { return; } - // We need to capture an owning-string in the lambda because the lambda - // is invoked in a deferred manner. - std::string LabelStr(Label); - auto DumpWithIndent = [this, DoAddChild, LabelStr](bool IsLastChild) { + auto DumpWithIndent = [this, DoAddChild, + Label(Label.str())](bool IsLastChild) { // Print out the appropriate tree structure and work out the prefix for // children of this node. For instance: // @@ -89,8 +87,8 @@ class TextTreeStructure { OS << '\n'; ColorScope Color(OS, ShowColors, IndentColor); OS << Prefix << (IsLastChild ? '`' : '|') << '-'; - if (!LabelStr.empty()) - OS << LabelStr << ": "; + if (!Label.empty()) + OS << Label << ": "; this->Prefix.push_back(IsLastChild ? ' ' : '|'); this->Prefix.push_back(' '); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits