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

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 16 12:30:51 PST 2017


arphaman added inline comments.


================
Comment at: docs/LanguageExtensions.rst:2349
+attribute is supported by the pragma by referring to the
+:doc:`individual documentation for that attribute <AttributeReference>`.
----------------
arphaman wrote:
> efriedma wrote:
> > I'm wondering if we can tweak the approach so that we don't have to separately define how this works for each attribute; for example, `#pragma clang attribute_function_declaration push(...)` would apply to each function declaration, `#pragma clang attribute_global_variable_declaration push(...)` would apply to each global variable declaration, etc.
> I agree with this idea, I think it would be useful to have the ability to specify the target declarations. I do think it would be better to use the 'clang attribute' umbrella pragma, and maybe add an extra argument to the 'push', e.g.:
> 
> ```
> #pragma attribute push (annotate("functions-only"), applicable_to=function) // or maybe received_by=?
> #pragma attribute push (annotate("struct+enum"), applicable_to=struct, applicable_to=enum)
> ```
I think that the further tweaks that control which declarations receive the attributes should be kept for a follow-up patch.


Repository:
  rL LLVM

https://reviews.llvm.org/D30009





More information about the cfe-commits mailing list