[clang] [clang][bytecode] Remove unused members from `EvalEmitter` (PR #186601)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 14 08:18:56 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
Remove the DenseMap handling lambda paramter mappings from `EvalEmitter`. This was always unused. Remove it and use `if constexpr` to keep things compiling.
---
Full diff: https://github.com/llvm/llvm-project/pull/186601.diff
2 Files Affected:
- (modified) clang/lib/AST/ByteCode/Compiler.cpp (+15-11)
- (modified) clang/lib/AST/ByteCode/EvalEmitter.h (-4)
``````````diff
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 13d6dcc92356d..8bbdf284b313d 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -5776,10 +5776,12 @@ bool Compiler<Emitter>::VisitCXXThisExpr(const CXXThisExpr *E) {
if (DiscardResult)
return true;
- if (this->LambdaThisCapture.Offset > 0) {
- if (this->LambdaThisCapture.IsPtr)
- return this->emitGetThisFieldPtr(this->LambdaThisCapture.Offset, E);
- return this->emitGetPtrThisField(this->LambdaThisCapture.Offset, E);
+ if constexpr (!std::is_same_v<Emitter, EvalEmitter>) {
+ if (this->LambdaThisCapture.Offset > 0) {
+ if (this->LambdaThisCapture.IsPtr)
+ return this->emitGetThisFieldPtr(this->LambdaThisCapture.Offset, E);
+ return this->emitGetPtrThisField(this->LambdaThisCapture.Offset, E);
+ }
}
// In some circumstances, the 'this' pointer does not actually refer to the
@@ -7491,14 +7493,16 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
return this->visitDeclRef(D, E);
};
- // Lambda captures.
- if (auto It = this->LambdaCaptures.find(D);
- It != this->LambdaCaptures.end()) {
- auto [Offset, IsPtr] = It->second;
+ if constexpr (!std::is_same_v<Emitter, EvalEmitter>) {
+ // Lambda captures.
+ if (auto It = this->LambdaCaptures.find(D);
+ It != this->LambdaCaptures.end()) {
+ auto [Offset, IsPtr] = It->second;
- if (IsPtr)
- return this->emitGetThisFieldPtr(Offset, E);
- return this->emitGetPtrThisField(Offset, E);
+ if (IsPtr)
+ return this->emitGetThisFieldPtr(Offset, E);
+ return this->emitGetPtrThisField(Offset, E);
+ }
}
if (const auto *DRE = dyn_cast<DeclRefExpr>(E);
diff --git a/clang/lib/AST/ByteCode/EvalEmitter.h b/clang/lib/AST/ByteCode/EvalEmitter.h
index a9f87db5d7f8d..f5c51c5f3dfa0 100644
--- a/clang/lib/AST/ByteCode/EvalEmitter.h
+++ b/clang/lib/AST/ByteCode/EvalEmitter.h
@@ -92,10 +92,6 @@ class EvalEmitter : public SourceMapper {
/// Parameter indices.
llvm::DenseMap<const ParmVarDecl *, ParamOffset> Params;
- /// Lambda captures.
- llvm::DenseMap<const ValueDecl *, ParamOffset> LambdaCaptures;
- /// Offset of the This parameter in a lambda record.
- ParamOffset LambdaThisCapture{0, false};
/// Local descriptors.
llvm::SmallVector<SmallVector<Local, 8>, 2> Descriptors;
std::optional<SourceInfo> LocOverride = std::nullopt;
``````````
</details>
https://github.com/llvm/llvm-project/pull/186601
More information about the cfe-commits
mailing list