[llvm] [JITLink] Remove unnecessary SymbolStringPtr copy. (PR #190101)

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 1 21:04:08 PDT 2026


https://github.com/lhames created https://github.com/llvm/llvm-project/pull/190101

This was probably intended to be a `const SymbolStringPtr&` originally, but if we were going to copy it anyway it's better to just take the argument by value and std::move it.

>From 1ce97bb7c3bac0058e8abc32baeb71e80403bcc7 Mon Sep 17 00:00:00 2001
From: Lang Hames <lhames at gmail.com>
Date: Thu, 2 Apr 2026 15:00:42 +1100
Subject: [PATCH] [JITLink] Remove unnecessary SymbolStringPtr copy.

This was probably intended to be a `const SymbolStringPtr&` originally, but if
we were going to copy it anyway it's better to just take the argument by value
and std::move it.
---
 llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
index cb5d27b39efb6..d8edeed8a464a 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
@@ -525,7 +525,7 @@ class Symbol {
 
   /// Rename this symbol. The client is responsible for updating scope and
   /// linkage if this name-change requires it.
-  void setName(const orc::SymbolStringPtr Name) { this->Name = Name; }
+  void setName(orc::SymbolStringPtr Name) { this->Name = std::move(Name); }
 
   /// Returns true if this Symbol has content (potentially) defined within this
   /// object file (i.e. is anything but an external or absolute symbol).



More information about the llvm-commits mailing list