[PATCH] D153835: [Sema] Clone VisibilityAttr for functions in template instantiations

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 7 13:07:35 PDT 2023


rjmccall added a comment.

I agree that the change to test51 is the right result, yes.  The explicit visibility attribute on the template declaration should take precedence over the visibility of the types in the template parameter list, and then the explicit visibility attribute on the variables should take precedence over the visibility of the variable types, and then the instantiation should be a specialization of a default-visibility template with default-visibility arguments.  But I think that logic ought to be fixed in `getLVFor...`, not by changing the basic propagation of attributes.

> I actually think that the patch makes VisibilityAttr behave in a more normal way as the majority of attributes are cloned by instantiateTemplateAttribute in the tablegen-generated tools/clang/include/clang/Sema/AttrTemplateInstantiate.inc.

You're not really just cloning it, because making the cloned attribute implicit (i.e. giving it the effect of a visibility pragma instead of an attribute) is a huge difference.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153835/new/

https://reviews.llvm.org/D153835



More information about the cfe-commits mailing list