[llvm] 46ecf45 - [Support] Drop unnecessary std::move in JSON.h (NFC) (#166027)

via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 1 23:20:30 PDT 2025


Author: Kazu Hirata
Date: 2025-11-01T23:20:27-07:00
New Revision: 46ecf458e16bde0b5784d1cfe7837f683e54ee0d

URL: https://github.com/llvm/llvm-project/commit/46ecf458e16bde0b5784d1cfe7837f683e54ee0d
DIFF: https://github.com/llvm/llvm-project/commit/46ecf458e16bde0b5784d1cfe7837f683e54ee0d.diff

LOG: [Support] Drop unnecessary std::move in JSON.h (NFC) (#166027)

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

Identified with performance-move-const-arg.

Added: 
    

Modified: 
    llvm/include/llvm/Support/JSON.h

Removed: 
    


################################################################################
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