[llvm] [Support] Drop unnecessary std::move in JSON.h (NFC) (PR #166027)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 1 14:54:05 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/166027
fixUTF8 takes StringRef, so we do not need std::move here.
Identified with performance-move-const-arg.
>From 232a1b722453acb6dbb9811c608609ea56704f5b Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 1 Nov 2025 14:12:20 -0700
Subject: [PATCH] [Support] Drop unnecessary std::move in JSON.h (NFC)
fixUTF8 takes StringRef, so we do not need std::move here.
Identified with performance-move-const-arg.
---
llvm/include/llvm/Support/JSON.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/include/llvm/Support/JSON.h b/llvm/include/llvm/Support/JSON.h
index a973c56ff5605..ecaadd272622f 100644
--- a/llvm/include/llvm/Support/JSON.h
+++ b/llvm/include/llvm/Support/JSON.h
@@ -318,7 +318,7 @@ class Value {
Value(std::string V) : Type(T_String) {
if (LLVM_UNLIKELY(!isUTF8(V))) {
assert(false && "Invalid UTF-8 in value used as JSON");
- V = fixUTF8(std::move(V));
+ V = fixUTF8(V);
}
create<std::string>(std::move(V));
}
@@ -591,7 +591,7 @@ class ObjectKey {
ObjectKey(std::string S) : Owned(new std::string(std::move(S))) {
if (LLVM_UNLIKELY(!isUTF8(*Owned))) {
assert(false && "Invalid UTF-8 in value used as JSON");
- *Owned = fixUTF8(std::move(*Owned));
+ *Owned = fixUTF8(*Owned);
}
Data = *Owned;
}
More information about the llvm-commits
mailing list