[clang] [clang][bytecode][NFC] Remove unnecessary rvalue reference parameters (PR #218395)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 24 05:49:36 PDT 2026


https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/218395

DeclOrExpr is just pointer-sized, so copy them.

>From 34f562bae10e98cf0b3110c3b30b16d0ca011ae5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Mon, 24 Aug 2026 14:48:29 +0200
Subject: [PATCH] [clang][bytecode][NFC] Remove unnecessary rvalue reference
 parameters

DeclOrExpr is just pointer-sized, so copy them.
---
 clang/lib/AST/ByteCode/Compiler.cpp | 6 +++---
 clang/lib/AST/ByteCode/Compiler.h   | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 87d23bf5df0c8..b8cfe10f566c2 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -5330,8 +5330,8 @@ bool Compiler<Emitter>::emitConst(const APSInt &Value, const Expr *E) {
 }
 
 template <class Emitter>
-unsigned Compiler<Emitter>::allocateLocalPrimitive(DeclOrExpr &&Src,
-                                                   PrimType Ty, bool IsConst,
+unsigned Compiler<Emitter>::allocateLocalPrimitive(DeclOrExpr Src, PrimType Ty,
+                                                   bool IsConst,
                                                    bool IsVolatile,
                                                    ScopeKind SC) {
   // FIXME: There are cases where Src.isExpr() is wrong, e.g.
@@ -5348,7 +5348,7 @@ unsigned Compiler<Emitter>::allocateLocalPrimitive(DeclOrExpr &&Src,
 }
 
 template <class Emitter>
-UnsignedOrNone Compiler<Emitter>::allocateLocal(DeclOrExpr &&Src, QualType Ty,
+UnsignedOrNone Compiler<Emitter>::allocateLocal(DeclOrExpr Src, QualType Ty,
                                                 ScopeKind SC) {
   const ValueDecl *Key = nullptr;
   const Expr *Init = nullptr;
diff --git a/clang/lib/AST/ByteCode/Compiler.h b/clang/lib/AST/ByteCode/Compiler.h
index 40589b45fa051..f34809cd0f14c 100644
--- a/clang/lib/AST/ByteCode/Compiler.h
+++ b/clang/lib/AST/ByteCode/Compiler.h
@@ -346,12 +346,12 @@ class Compiler : public ConstStmtVisitor<Compiler<Emitter>, bool>,
                      bool Activate, bool IsOperatorCall);
 
   /// Creates a local primitive value.
-  unsigned allocateLocalPrimitive(DeclOrExpr &&Decl, PrimType Ty, bool IsConst,
+  unsigned allocateLocalPrimitive(DeclOrExpr Decl, PrimType Ty, bool IsConst,
                                   bool IsVolatile = false,
                                   ScopeKind SC = ScopeKind::Block);
 
   /// Allocates a space storing a local given its type.
-  UnsignedOrNone allocateLocal(DeclOrExpr &&Decl, QualType Ty = QualType(),
+  UnsignedOrNone allocateLocal(DeclOrExpr Decl, QualType Ty = QualType(),
                                ScopeKind = ScopeKind::Block);
   UnsignedOrNone allocateTemporary(const Expr *E);
 



More information about the cfe-commits mailing list