[clang] [clang][bytecode][NFC] Fix some copies in for-range loops (PR #215544)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 11 05:42:15 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/215544.diff
3 Files Affected:
- (modified) clang/lib/AST/ByteCode/ByteCodeEmitter.cpp (+1-1)
- (modified) clang/lib/AST/ByteCode/Compiler.cpp (+1-1)
- (modified) clang/lib/AST/ByteCode/Program.h (+1-1)
``````````diff
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();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/215544
More information about the cfe-commits
mailing list