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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 21 10:01:58 PDT 2017


aaron.ballman added a comment.

In https://reviews.llvm.org/D30009#706171, @arphaman wrote:

> 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`).


That sounds sensible to me.

> 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.

Okay, so here's a possibly crazy idea (and it may be way too magical): what if `#pragma clang attribute push(foo)` generated the fix-it hint to suggest all of the targets the attribute can apply to? Alternatively, what if any malformed parsing of `#pragma clang attribute push(foo)` automatically do this? We know the user is trying to apply attributes to declarations, and we know which attribute they're trying for, so it somewhat stands to reason that the rest of the syntax can be supplied for them... and we need *something* in apply_to, so why not default to everything?


Repository:
  rL LLVM

https://reviews.llvm.org/D30009





More information about the cfe-commits mailing list