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

None

>From 73b47f02f934152d51e50d8f7e3fa7bf3f767106 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]>
Date: Tue, 11 Aug 2026 14:40:42 +0200
Subject: [PATCH] [clang][bytecode][NFC] Fix some copies in for-range loops

---
 clang/lib/AST/ByteCode/ByteCodeEmitter.cpp | 2 +-
 clang/lib/AST/ByteCode/Compiler.cpp        | 2 +-
 clang/lib/AST/ByteCode/Program.h           | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/clang/lib/AST/ByteCode/ByteCodeEmitter.cpp 
b/clang/lib/AST/ByteCode/ByteCodeEmitter.cpp
index 393b8481fecd1..0a8a766ed8a4e 100644
--- a/clang/lib/AST/ByteCode/ByteCodeEmitter.cpp
+++ b/clang/lib/AST/ByteCode/ByteCodeEmitter.cpp
@@ -42,7 +42,7 @@ void ByteCodeEmitter::compileFunc(const FunctionDecl 
*FuncDecl,
 
     ParentDecl->getCaptureFields(LC, LTC);
 
-    for (auto Cap : LC) {
+    for (const auto &Cap : LC) {
       unsigned Offset = R->getField(Cap.second)->Offset;
       this->LambdaCaptures[Cap.first] = {
           Offset, Cap.second->getType()->isReferenceType()};
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp 
b/clang/lib/AST/ByteCode/Compiler.cpp
index 316b2a4f092f9..e99f3fc5ebba2 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -6967,7 +6967,7 @@ bool Compiler<Emitter>::visitBreakStmt(const BreakStmt 
*S) {
       }
     }
   } else {
-    for (auto LI : LabelInfoStack) {
+    for (const auto &LI : LabelInfoStack) {
       if (LI.Name == TargetLoop) {
         TargetLabel = *LI.BreakLabel;
         BreakScope = LI.BreakOrContinueScope;
diff --git a/clang/lib/AST/ByteCode/Program.h b/clang/lib/AST/ByteCode/Program.h
index 7687f437ca680..c2299a1e10191 100644
--- a/clang/lib/AST/ByteCode/Program.h
+++ b/clang/lib/AST/ByteCode/Program.h
@@ -49,7 +49,7 @@ class Program final {
     // Records might actually allocate memory themselves, but they
     // are allocated using a BumpPtrAllocator. Call their desctructors
     // here manually so they are properly freeing their resources.
-    for (auto RecordPair : Records) {
+    for (const auto &RecordPair : Records) {
       if (Record *R = RecordPair.second)
         R->~Record();
     }

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to