[llvm] 7353ca7 - [NFC][TableGen] Use std::move to avoid copy (#180785)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 11 00:15:28 PST 2026


Author: JaydeepChauhan14
Date: 2026-02-11T13:45:24+05:30
New Revision: 7353ca74ad38837fdcfa86eb3a4595548b3988d0

URL: https://github.com/llvm/llvm-project/commit/7353ca74ad38837fdcfa86eb3a4595548b3988d0
DIFF: https://github.com/llvm/llvm-project/commit/7353ca74ad38837fdcfa86eb3a4595548b3988d0.diff

LOG: [NFC][TableGen] Use std::move to avoid copy (#180785)

Added: 
    

Modified: 
    llvm/include/llvm/TableGen/TableGenBackend.h
    llvm/lib/TableGen/Main.cpp
    llvm/lib/TableGen/TableGenBackend.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/TableGen/TableGenBackend.h b/llvm/include/llvm/TableGen/TableGenBackend.h
index 8450a02eb19e7..2080b8245e11a 100644
--- a/llvm/include/llvm/TableGen/TableGenBackend.h
+++ b/llvm/include/llvm/TableGen/TableGenBackend.h
@@ -62,7 +62,7 @@ template <class EmitterC> class OptClass : Opt {
     std::string S;
     raw_string_ostream OS(S);
     EmitterC(RK).run(OS);
-    return {S, {}};
+    return {std::move(S), {}};
   }
 
 public:

diff  --git a/llvm/lib/TableGen/Main.cpp b/llvm/lib/TableGen/Main.cpp
index ec4579f378dcb..cac70165b4131 100644
--- a/llvm/lib/TableGen/Main.cpp
+++ b/llvm/lib/TableGen/Main.cpp
@@ -214,7 +214,7 @@ int llvm::TableGenMain(const char *argv0, TableGenMainFn MainFn) {
     std::string S;
     raw_string_ostream OS(S);
     int Res = MainFn(OS, Records);
-    OutFiles = {S, {}};
+    OutFiles = {std::move(S), {}};
     return Res;
   });
 }

diff  --git a/llvm/lib/TableGen/TableGenBackend.cpp b/llvm/lib/TableGen/TableGenBackend.cpp
index 116c3fcca8bd8..eabc4651b52c0 100644
--- a/llvm/lib/TableGen/TableGenBackend.cpp
+++ b/llvm/lib/TableGen/TableGenBackend.cpp
@@ -68,7 +68,7 @@ bool llvm::TableGen::Emitter::ApplyCallback(const RecordKeeper &Records,
     std::string S;
     raw_string_ostream OS(S);
     Fn.SingleFileGenerator(Records, OS);
-    OutFiles = {S, {}};
+    OutFiles = {std::move(S), {}};
     return false;
   }
   if (Fn.MultiFileGenerator) {


        


More information about the llvm-commits mailing list