[llvm] [ADT] Add a missing std::move to StringSwitch::EndsWithLower (PR #167151)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 8 08:32:23 PST 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/167151

All others seem to use std::move in StringSwitch.


>From d2f4a7fe9bebaf002da7ce4a5b91e07d4cab561b Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 7 Nov 2025 13:48:37 -0800
Subject: [PATCH] [ADT] Add a missing std::move to StringSwitch::EndsWithLower

All others seem to use std::move in StringSwitch.
---
 llvm/include/llvm/ADT/StringSwitch.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/ADT/StringSwitch.h b/llvm/include/llvm/ADT/StringSwitch.h
index 53ebec1eb3a54..5da6076c27390 100644
--- a/llvm/include/llvm/ADT/StringSwitch.h
+++ b/llvm/include/llvm/ADT/StringSwitch.h
@@ -158,7 +158,7 @@ class StringSwitch {
 
   StringSwitch &EndsWithLower(StringLiteral S, T Value) {
     if (!Result && Str.ends_with_insensitive(S))
-      Result = Value;
+      Result = std::move(Value);
 
     return *this;
   }



More information about the llvm-commits mailing list