[PATCH] D146148: Float_t and double_t types shouldn't be modified by #pragma clang fp eval_method

Zahira Ammarguellat via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 23 11:22:05 PDT 2023


zahiraam added a comment.

In D146148#4213475 <https://reviews.llvm.org/D146148#4213475>, @rjmccall wrote:

> The user isn't modifying the `float_t` type definition, they're using it.  I think the diagnostic should say something like `cannot use type 'float_t' within '#pragma clang fp eval_method'; type is set according to the default eval method for the translation unit`.
>
> Is there any way we can infer an attribute for these typedefs when they're declared, then diagnose it in `DiagnoseUseOfDecl`?  Some sort of "available_only_in_default_eval_method" attribute?

@rjmccall Thanks for the review.
I might be able to call the DiagnoseUseOfDecl here https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaType.cpp#L1609 but I don't seem to have access to the NameDecl (first argument of the function). I am not familiar with the attribute. Can you point me to an example?
Thanks.


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

https://reviews.llvm.org/D146148



More information about the cfe-commits mailing list