[PATCH] D143919: [Clang] Copy strictfp attribute from pattern to instantiation

Serge Pavlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 15 02:59:42 PST 2023


sepavloff added a comment.

In D143919#4123922 <https://reviews.llvm.org/D143919#4123922>, @rjmccall wrote:

> In D143919#4123712 <https://reviews.llvm.org/D143919#4123712>, @sepavloff wrote:
>
>> In D143919#4123616 <https://reviews.llvm.org/D143919#4123616>, @efriedma wrote:
>>
>>> We have code somewhere to generically copy attributes from function templates to instantiations, right?  Why do we need to explicitly copy StrictFPAttr in particular, separate from that?
>>
>> Could you please point me out to this code? I didn't find it.
>
> It's the call to `InstantiateAttrs` in `InitFunctionInstantiation`.  `InstantiateAttrs` hard-codes a list of attributes to clone, which seems like a bad design, but it's easy enough to add your attribute as another case to that list.

Thanks!
`InstantiateAttrs` is updated accordingly. It solves the problem but not for late-parsed templates. Strictfp is evaluated based on function body, but when a declaration for late-parsed template is instantiated, the body is absent yet. A new method is added to Sema to make attribute update when template body is available.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143919



More information about the cfe-commits mailing list