cor3ntin wrote:

> Which call in EmitGlobal is the one that calls it? I would expect that either 
> of the two (not hte annotations one for obvious reasons) should be able to 
> filter it THERE instead. Do we perhaps just mangle 'too early'?

We use the mangle name as key to decide whether something was already used haha

```
  StringRef MangledName = getMangledName(GD);
  if (GetGlobalValue(MangledName) != nullptr) {
    // The value has already been used and should therefore be emitted.
    addDeferredDeclToEmit(GD);
  } else if (MustBeEmitted(Global)) {
    // The value must be emitted, but cannot be emitted eagerly.
    assert(!MayBeEmittedEagerly(Global));
    addDeferredDeclToEmit(GD);
  } else {
    // Otherwise, remember that we saw a deferred decl with this name.  The
    // first use of the mangled name will cause it to move into
    // DeferredDeclsToEmit.
    DeferredDecls[MangledName] = GD;
  }```

But really i don't think we should even get there from an unevaluated context

https://github.com/llvm/llvm-project/pull/124572
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to