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

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 15 16:15:43 PST 2017


efriedma added inline comments.


================
Comment at: docs/LanguageExtensions.rst:2344
+declaration failed to receive the attribute because of a compilation error. The
+attributes that aren't applied to any declaration are not verified semantically.
+
----------------
I think "to each declaration individually" needs to expanded on a bit here.  It's not clear how this interacts with namespaces, or classes, or function declarations, or function definitions, or templates.  For example, if you declare a function inside of a `#pragma clang attribute push(annotate("custom"))`, does that add an attribute to each parameter of the function?


================
Comment at: docs/LanguageExtensions.rst:2349
+attribute is supported by the pragma by referring to the
+:doc:`individual documentation for that attribute <AttributeReference>`.
----------------
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.


Repository:
  rL LLVM

https://reviews.llvm.org/D30009





More information about the cfe-commits mailing list