[PATCH] D39627: Fix vtable not receiving hidden visibility when using push(visibility)

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 3 23:43:30 PDT 2017


rjmccall added a comment.

Hmm.  We're calling this from getAddrOfVTable, which can be used to get a declaration for an external v-table, but setGlobalVisibility appears to set visibility as if we were emitting a definition.  Among other reasons, the difference is important because we generally don't honor implicit visibility when emitting external references.  The pragma should be treated as an explicit source of visibility — IIRC we model it by actually adding a visibility attribute — but I think your patch would cause us to use hidden visibility on an external v-table declaration even if the only reason we thought it was hidden was that we were compiling under -fvisibility=hidden.

The logic for declarations is currently defined in the function setLinkageAndVisibilityForGV in CodeGenModule.cpp.  That's a static function in that file: we could just add it to CodeGenModule, but I think there's a better solution: we could add a ForDefinition_t flag to CGM::setGlobalVisibility and then unify these two implementations.


Repository:
  rL LLVM

https://reviews.llvm.org/D39627





More information about the llvm-commits mailing list