[clang] [Attributes] Support Attributes being declared as only supporting late parsing when passing an experimental feature flag (PR #88596)
Dan Liew via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 15 17:11:52 PDT 2024
================
@@ -592,6 +592,46 @@ class AttrSubjectMatcherAggregateRule<AttrSubject subject> {
def SubjectMatcherForNamed : AttrSubjectMatcherAggregateRule<Named>;
+// Late Attribute parsing mode enum
+class LateAttrParseKind <int val> {
+ int Kind = val;
+}
+
+// Never late parsed
+def LateAttrParseNever : LateAttrParseKind<0>;
+
+// Standard late attribute parsing
+//
+// This is language dependent. For example:
+//
+// * For C++ enables late parsing of a declaration attributes
+// * For C does not enable late parsing of attributes
+//
+def LateAttrParseStandard: LateAttrParseKind<1>;
+
+// Experimental extension to standard late attribute parsing
+//
+// This extension behaves like `LateAttrParseStandard` but allows
+// late parsing attributes in more contexts.
+//
+// This extension changes behavior depending on whether the
+// `-fexperimental-late-parse-attributes`
+// (`LangOpts.ExperimentalLateParseAttributes`) flag is enabled.
+//
+// * If the flag is disabled then the attribute is parsed just like
+// `LateAttrParseStandard`.
+//
+// * If the flag is enabled and if the attribute is being used in a context
+// supported by this extension it will be late parsed. Otherwise the attribute
+// will be parsed just like `LateAttrParseStandard`.
+//
+// Currently this extension extends `LateAttrParseStandard` by allowing:
+//
+// * For C, late parsing of the `counted_by` as a type or decl attribute.
+// (TODO: Not implemented yet).
----------------
delcypher wrote:
@rapidsna Maybe I should drop this bit because of the `TODO`?
https://github.com/llvm/llvm-project/pull/88596
More information about the cfe-commits
mailing list