[llvm] GCStrategy: Use Twine properly for error message (PR #132760)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 24 08:36:13 PDT 2025
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/132760
Avoid unnecessary std::string temporaries.
>From 0cf71d7ddce2d202db9923db779aeda0a3cc3f76 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Mon, 24 Mar 2025 22:27:49 +0700
Subject: [PATCH] GCStrategy: Use Twine properly for error message
Avoid unnecessary std::string temporaries.
---
llvm/lib/IR/GCStrategy.cpp | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/llvm/lib/IR/GCStrategy.cpp b/llvm/lib/IR/GCStrategy.cpp
index c3e35bd58d13e..67f363d26b25f 100644
--- a/llvm/lib/IR/GCStrategy.cpp
+++ b/llvm/lib/IR/GCStrategy.cpp
@@ -41,10 +41,9 @@ std::unique_ptr<GCStrategy> llvm::getGCStrategy(const StringRef Name) {
// be the builtin GCs if nothing else. The most likely scenario here is
// that we got here without running the initializers used by the Registry
// itself and it's registration mechanism.
- const std::string error =
- std::string("unsupported GC: ") + Name.str() +
- " (did you remember to link and initialize the library?)";
- report_fatal_error(Twine(error));
+ report_fatal_error(
+ "unsupported GC: " + Name +
+ " (did you remember to link and initialize the library?)");
} else
- report_fatal_error(Twine(std::string("unsupported GC: ") + Name.str()));
+ report_fatal_error(Twine("unsupported GC: ") + Name);
}
More information about the llvm-commits
mailing list