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

via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 24 05:50:16 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>

DeclOrExpr is just pointer-sized, so copy them.

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


2 Files Affected:

- (modified) clang/lib/AST/ByteCode/Compiler.cpp (+3-3) 
- (modified) clang/lib/AST/ByteCode/Compiler.h (+2-2) 


``````````diff
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);
 

``````````

</details>


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


More information about the cfe-commits mailing list