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

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


erichkeane wrote:

> > 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.
> 
> I'm a bit less sold on this approach, but only due to the user confusion that stems from it. Enum arguments can be strings or identifiers and that's caused some surprise for people in the past. Users are used to enumerations being identifiers not strings, and I think users are similarly used to identifiers being identifiers and not strings.
> 
> I kind of think "no enforcement for invalid input" is reasonable here. That would be consistent with things like the `alias` attribute where we accept a string that has to conform to ABI mangling rules (which could be a matter of poor QoI rather than precedent).

Hmm... sure.  The status quo is acceptable here I think, this is a 'power user' feature and they are expected to type something useful.  I guess I COULD see value in ensuring we don't have any characters that would break linking, but all of the examples in the above tests seem to mangle and link 'fine'.

Itanium ABI rules or not, the implementation has accepted 'everything' long enough that any sort of enforcement could very well be a breaking change.  I think after discussion, I'm not particularly motivated to do anything here.

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


More information about the cfe-commits mailing list