[llvm] [llvm] Avoid premature Twine .str() materialization (PR #204828)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 19 07:05:31 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- llvm/lib/Bitcode/Reader/BitcodeReader.cpp llvm/lib/CAS/OnDiskGraphDB.cpp llvm/lib/CAS/OnDiskKeyValueDB.cpp llvm/lib/MC/MCObjectFileInfo.cpp llvm/lib/ObjCopy/COFF/COFFObjcopy.cpp llvm/lib/TableGen/TGParser.cpp llvm/lib/Transforms/IPO/InstrumentorConfigFile.cpp llvm/lib/Transforms/IPO/InstrumentorUtils.cpp llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp llvm/tools/llvm-objdump/llvm-objdump.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/ObjCopy/COFF/COFFObjcopy.cpp b/llvm/lib/ObjCopy/COFF/COFFObjcopy.cpp
index d68d34b42..48c488826 100644
--- a/llvm/lib/ObjCopy/COFF/COFFObjcopy.cpp
+++ b/llvm/lib/ObjCopy/COFF/COFFObjcopy.cpp
@@ -226,10 +226,10 @@ static Error handleArgs(const CommonConfig &Config,
     if (Config.SymbolsToRemove.matches(Sym.Name)) {
       // Explicitly removing a referenced symbol is an error.
       if (Sym.Referenced)
-        return createStringError(
-            llvm::errc::invalid_argument,
-            "'" + Config.OutputFilename + "': not stripping symbol '" +
-                Sym.Name + "' because it is named in a relocation");
+        return createStringError(llvm::errc::invalid_argument,
+                                 "'" + Config.OutputFilename +
+                                     "': not stripping symbol '" + Sym.Name +
+                                     "' because it is named in a relocation");
       return true;
     }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/204828


More information about the llvm-commits mailing list