[clang] Ignore template parameter visibility (PR #72092)

John McCall via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 14 12:03:08 PST 2023


rjmccall wrote:

The basic design idea behind Clang's visibility model is to treat hidden visibility as essentially a second grade of external linkage, external to the translation unit but internal to the linkage unit (i.e. image).  So what you pointed out about using an anonymous namespace is exactly the intent: just like using an internal-linkage entity in a declaration should force it to have internal linkage, using a hidden-visibility entity in a declaration should force it to have hidden visibility.

We then have to deal with the legacy that people often don't set template visibility right and try to patch it up with explicit visibility attributes on explicit instantiations and specializations.  We want to treat that as a "big hammer" that overrides all of our normal considerations, at least as far as that specific declaration goes.  This is not a problem with linkage because there's no way to override linkage this way.

https://github.com/llvm/llvm-project/pull/72092


More information about the cfe-commits mailing list