[PATCH] D30009: Add support for '#pragma clang attribute'

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 21 03:57:00 PDT 2017


arphaman added a comment.

In https://reviews.llvm.org/D30009#705699, @aaron.ballman wrote:

> In https://reviews.llvm.org/D30009#705649, @efriedma wrote:
>
> > Looking over the most recent version, I'm happy with the general semantics of push with apply_only_to.  I'm not sure I see the point of apply_to: it doesn't allow the user to do anything that can't be done with apply_only_to.  Also, if the apply_to list for an attribute ever changes, it becomes impossible to write code which supports both versions of the compiler.
>


This is a good point that I haven't considered.

> You bring up a really good point about compiler versioning -- it would be pretty awful to force the user to use #ifs to deal with that.
> 
> I believe apply_to is somewhat useful so that the user knows what an attribute actually appertains to, and get a diagnostic if we ever extend the list of things their particular attribute can appertain to so they are forced to decide whether they want that new behavior or not.
> 
> @arphaman, what do you think about the idea of only having apply_to with the same semantics as you currently have for apply_only_to?

I would be ok with that. We could merge `apply_to` and `apply_only_to` into a single `apply_to` matching rule set specifier (it would behave like `apply_only_to`).

I guess one downside would be is that it will become harder to fill out all the match rules if one wants to apply an attribute to all possible declarations. I suppose the attribute documentation generator can be updated to include the full match rule set for each attribute instead of just yes/no in the `#pragma clang attribute` documentation column.


Repository:
  rL LLVM

https://reviews.llvm.org/D30009





More information about the cfe-commits mailing list