[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
Sat Apr 13 22:36:04 PDT 2024


================
@@ -1822,28 +1822,106 @@ void WriteSemanticSpellingSwitch(const std::string &VarName,
   OS << "  }\n";
 }
 
+enum class LateAttrParseKind {
+  LateAttrParsingNever = 0,
+  LateAttrParsingAlways = 1,
+  LateAttrParsingExperimentalOnly = 2
+};
+
----------------
delcypher wrote:

Yes. The current implementation relies on the name of the enum value and the name in `Attr.td` file being the same for the purposes of verifying the enum is in sync with the corresponding definition in the `Attr.td` file.

You can see this here:

```c++
#define CASE(X)                                                                \
  case LateAttrParseKind::X:                                                   \
    if (LAPK->getName().compare(#X) != 0) {    
```

`LAPK->getName()` is the name of the definition in the `Attr.td` file and `X` in the macro if the enum name in the `LateAttrParseKind`.

https://github.com/llvm/llvm-project/pull/88596


More information about the cfe-commits mailing list