[llvm] fixed #95641 pointless string copy (PR #127325)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 22 06:05:03 PST 2025
https://github.com/sommersun updated https://github.com/llvm/llvm-project/pull/127325
>From 538a31bc4bda485ed9acef1560c3f90a8f7cf444 Mon Sep 17 00:00:00 2001
From: sxx <948074686 at qq.com>
Date: Sat, 15 Feb 2025 21:56:28 +0800
Subject: [PATCH] #95641 pointless string copy
---
llvm/include/llvm/TableGen/Record.h | 2 +-
llvm/lib/TableGen/Main.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/include/llvm/TableGen/Record.h b/llvm/include/llvm/TableGen/Record.h
index e04ed34823148..334007524c954 100644
--- a/llvm/include/llvm/TableGen/Record.h
+++ b/llvm/include/llvm/TableGen/Record.h
@@ -1967,7 +1967,7 @@ class RecordKeeper {
}
void saveInputFilename(std::string Filename) {
- InputFilename = Filename;
+ InputFilename = std::move(Filename);
}
void addClass(std::unique_ptr<Record> R) {
diff --git a/llvm/lib/TableGen/Main.cpp b/llvm/lib/TableGen/Main.cpp
index 35600bf2f1f86..81b2e81dc6064 100644
--- a/llvm/lib/TableGen/Main.cpp
+++ b/llvm/lib/TableGen/Main.cpp
@@ -113,7 +113,7 @@ int llvm::TableGenMain(const char *argv0,
return reportError(argv0, "Could not open input file '" + InputFilename +
"': " + EC.message() + "\n");
- Records.saveInputFilename(InputFilename);
+ Records.saveInputFilename(std::move(InputFilename));
// Tell SrcMgr about this buffer, which is what TGParser will pick up.
SrcMgr.AddNewSourceBuffer(std::move(*FileOrErr), SMLoc());
More information about the llvm-commits
mailing list