[clang] 8bc61cb - [Clang][ByteCode][NFC] Avoid copies by using move in Disasm.cpp (#146127)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 27 14:53:24 PDT 2025
Author: Shafik Yaghmour
Date: 2025-06-27T14:53:20-07:00
New Revision: 8bc61cbfde28c014b8d18ae8066f1371808d2aa7
URL: https://github.com/llvm/llvm-project/commit/8bc61cbfde28c014b8d18ae8066f1371808d2aa7
DIFF: https://github.com/llvm/llvm-project/commit/8bc61cbfde28c014b8d18ae8066f1371808d2aa7.diff
LOG: [Clang][ByteCode][NFC] Avoid copies by using move in Disasm.cpp (#146127)
Static analysis flagged some cases we could avoid copies by using
std::move in Disasm.cpp.
Added:
Modified:
clang/lib/AST/ByteCode/Disasm.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/ByteCode/Disasm.cpp b/clang/lib/AST/ByteCode/Disasm.cpp
index a3eecd06369b1..f64501f4a31e8 100644
--- a/clang/lib/AST/ByteCode/Disasm.cpp
+++ b/clang/lib/AST/ByteCode/Disasm.cpp
@@ -63,7 +63,7 @@ template <> inline std::string printArg<Floating>(Program &P, CodePtr &OpPC) {
std::string S;
llvm::raw_string_ostream SS(S);
- SS << Result;
+ SS << std::move(Result);
return S;
}
@@ -81,7 +81,7 @@ inline std::string printArg<IntegralAP<false>>(Program &P, CodePtr &OpPC) {
std::string Str;
llvm::raw_string_ostream SS(Str);
- SS << Result;
+ SS << std::move(Result);
return Str;
}
@@ -99,7 +99,7 @@ inline std::string printArg<IntegralAP<true>>(Program &P, CodePtr &OpPC) {
std::string Str;
llvm::raw_string_ostream SS(Str);
- SS << Result;
+ SS << std::move(Result);
return Str;
}
@@ -109,7 +109,7 @@ template <> inline std::string printArg<FixedPoint>(Program &P, CodePtr &OpPC) {
std::string Result;
llvm::raw_string_ostream SS(Result);
- SS << F;
+ SS << std::move(F);
return Result;
}
More information about the cfe-commits
mailing list