Skip to content

Conversation

kazutakahirata
Copy link
Contributor

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

std::move on StringRef is not useful because it's copied anyway.
@llvmbot
Copy link
Member

llvmbot commented Aug 30, 2025

@llvm/pr-subscribers-llvm-adt

Author: Kazu Hirata (kazutakahirata)

Changes

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 --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;
   }

@kazutakahirata kazutakahirata merged commit f6157c7 into llvm:main Aug 30, 2025
11 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250829_StringMap_at_move branch August 30, 2025 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants