[llvm] [ADT] Remove a meaningless std::move (NFC) (PR #156138)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 29 20:58:31 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-adt

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

std::move on StringRef is not useful because it's copied anyway.


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


1 Files Affected:

- (modified) llvm/include/llvm/ADT/StringMap.h (+1-1) 


``````````diff
diff --git a/llvm/include/llvm/ADT/StringMap.h b/llvm/include/llvm/ADT/StringMap.h
index dbc0485967ac6..e8100abec8d3a 100644
--- a/llvm/include/llvm/ADT/StringMap.h
+++ b/llvm/include/llvm/ADT/StringMap.h
@@ -264,7 +264,7 @@ class LLVM_ALLOCATORHOLDER_EMPTYBASE StringMap
   /// at - Return the entry for the specified key, or abort if no such
   /// entry exists.
   const ValueTy &at(StringRef Val) const {
-    auto Iter = this->find(std::move(Val));
+    auto Iter = this->find(Val);
     assert(Iter != this->end() && "StringMap::at failed due to a missing key");
     return Iter->second;
   }

``````````

</details>


https://github.com/llvm/llvm-project/pull/156138


More information about the llvm-commits mailing list