[clang] [clang] Validate ABI tag attributes (PR #84272)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 7 07:01:45 PST 2024


https://github.com/erichkeane requested changes to this pull request.

I think this is a case of 'cure is worse than the disease'.  Unless this implements our 'identifier' rules, it is just going to reject valid code.  

Any sort of enforcement here on individual characters NEEDS to follow the rules of the language in the current language mode.  

I see two approaches here: First, we can try to recreate the rules from Lex here, which I believe is a very difficult task to do accurately.

Second: We create a new `Argument` type in `Attr.td`, and the code-gen infrastructure for it that takes an "identifier surrounded by quotes" (sort of a mix between `IdentifierArgument` and `StringArgument`). This has the effect of using our 'normal' parsing rules and diagnostics for the identifier.

The latter sounds more robust to me, and lacks the difficulty of the 1st, albeit with some infrastructure work to deal with in Tablegen.

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


More information about the cfe-commits mailing list