================
@@ -3779,6 +3833,23 @@ LValue CodeGenFunction::EmitDeclRefLValue(const
DeclRefExpr *E) {
// an enclosing scope.
if (const auto *BD = dyn_cast<BindingDecl>(ND)) {
if (E->refersToEnclosingVariableOrCapture()) {
+ // Try direct lookup first.
+ auto It = LocalDeclMap.find(BD->getCanonicalDecl());
+ if (It != LocalDeclMap.end()) {
+ return MakeAddrLValue(It->second, E->getType(), AlignmentSource::Decl);
+ }
----------------
alexey-bataev wrote:
```suggestion
if (It != LocalDeclMap.end())
return MakeAddrLValue(It->second, E->getType(), AlignmentSource::Decl);
```
https://github.com/llvm/llvm-project/pull/190832
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits