Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

fixUTF8 takes StringRef, so we do not need std::move here.

Identified with performance-move-const-arg.

fixUTF8 takes StringRef, so we do not need std::move here.

Identified with performance-move-const-arg.
@llvmbot
Copy link
Member

llvmbot commented Nov 1, 2025

@llvm/pr-subscribers-llvm-support

Author: Kazu Hirata (kazutakahirata)

Changes

fixUTF8 takes StringRef, so we do not need std::move here.

Identified with performance-move-const-arg.


Full diff: https://github.com/llvm/llvm-project/pull/166027.diff

1 Files Affected:

  • (modified) llvm/include/llvm/Support/JSON.h (+2-2)
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;
   }

@kazutakahirata kazutakahirata merged commit 46ecf45 into llvm:main Nov 2, 2025
12 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20251101a_drop_std_move branch November 2, 2025 06:20
DEBADRIBASAK pushed a commit to DEBADRIBASAK/llvm-project that referenced this pull request Nov 3, 2025
fixUTF8 takes StringRef, so we do not need std::move here.

Identified with performance-move-const-arg.
ckoparkar pushed a commit to ckoparkar/llvm-project that referenced this pull request Nov 6, 2025
fixUTF8 takes StringRef, so we do not need std::move here.

Identified with performance-move-const-arg.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants