[llvm] 3df03db - [CodeGen] Refactor `warn()` to use StringRef (NFCI) (#127537)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 20 00:34:25 PST 2025
Author: Narayan
Date: 2025-02-20T08:34:21Z
New Revision: 3df03db689f1072d04a815a8893c395010988c53
URL: https://github.com/llvm/llvm-project/commit/3df03db689f1072d04a815a8893c395010988c53
DIFF: https://github.com/llvm/llvm-project/commit/3df03db689f1072d04a815a8893c395010988c53.diff
LOG: [CodeGen] Refactor `warn()` to use StringRef (NFCI) (#127537)
closes #100064
Added:
Modified:
llvm/include/llvm/CGData/CodeGenData.h
llvm/lib/CGData/CodeGenData.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/CGData/CodeGenData.h b/llvm/include/llvm/CGData/CodeGenData.h
index da0e412f2a0e0..0e7dd2f5b5c1a 100644
--- a/llvm/include/llvm/CGData/CodeGenData.h
+++ b/llvm/include/llvm/CGData/CodeGenData.h
@@ -265,7 +265,7 @@ std::unique_ptr<Module> loadModuleForTwoRounds(BitcodeModule &OrigModule,
Expected<stable_hash> mergeCodeGenData(ArrayRef<StringRef> ObjectFiles);
void warn(Error E, StringRef Whence = "");
-void warn(Twine Message, std::string Whence = "", std::string Hint = "");
+void warn(Twine Message, StringRef Whence = "", StringRef Hint = "");
} // end namespace cgdata
diff --git a/llvm/lib/CGData/CodeGenData.cpp b/llvm/lib/CGData/CodeGenData.cpp
index 88dcdfd1f931a..bb6b9c7721d55 100644
--- a/llvm/lib/CGData/CodeGenData.cpp
+++ b/llvm/lib/CGData/CodeGenData.cpp
@@ -204,7 +204,7 @@ Expected<Header> Header::readFromBuffer(const unsigned char *Curr) {
namespace cgdata {
-void warn(Twine Message, std::string Whence, std::string Hint) {
+void warn(Twine Message, StringRef Whence, StringRef Hint) {
WithColor::warning();
if (!Whence.empty())
errs() << Whence << ": ";
@@ -216,7 +216,7 @@ void warn(Twine Message, std::string Whence, std::string Hint) {
void warn(Error E, StringRef Whence) {
if (E.isA<CGDataError>()) {
handleAllErrors(std::move(E), [&](const CGDataError &IPE) {
- warn(IPE.message(), Whence.str(), "");
+ warn(IPE.message(), Whence, "");
});
}
}
More information about the llvm-commits
mailing list