bd1976bris wrote:

> I mean, looking at the code, as far as I can tell, we always call 
> GetAddrOfVTT immediately before EmitVTTDefinition, so setGVProperties() has 
> already run, so running it again shouldn't do anything... unless somehow 
> EmitVTTDefinition is overwriting the visibility, or setGVProperties() behaves 
> differently for declarations vs. definitions. If something like that is 
> happening, I'd like to explicitly document it.

Thanks for clarifying. Luckily a full understanding of the VTT emission isn't 
isn't needed to answer your question :)

When the visibility is applied via visibility attributes there is no difference 
for a definition or a declaration. However, for the visibility from 
-fvisibility=<visibility>, the visibility is applied only to definitions and 
not to declarations. My understanding is that this is by design - so that 
system headers do not have to be marked with explicit visibility annotations.

You can see this in the code in setGlobalVisibility():

```
  if (LV.isVisibilityExplicit() || getLangOpts().SetVisibilityForExternDecls ||
      !GV->isDeclarationForLinker())
    GV->setVisibility(GetLLVMVisibility(LV.getVisibility()));
```

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

Reply via email to