================
@@ -194,7 +194,7 @@ static void emitDeclDestroy(CIRGenFunction &cgf, const 
VarDecl *vd,
     // The same applies to code above where it is calling getAddrOfGlobalVar.
     mlir::Value globalVal = builder.createGetGlobal(addr);
     globalVal.getDefiningOp<cir::GetGlobalOp>().setStaticLocal(
-        addr.getStaticLocalGuard().has_value());
+        addr.getDynamicInitGuard().has_value());
----------------
xakep8 wrote:

```cpp
int &get_ref();

struct S {
  inline static int &ref = get_ref();
};
```
The initializer can contain `cir.get_global static_local @S::ref`. But S::ref 
is namespace-scoped, and its dynamic_init_info says local=false.

It should also check `&& varDecl->isLocalVarDecl()`?

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

Reply via email to