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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 7 08:05:34 PST 2024


AaronBallman wrote:

> > 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).
> 
> If I'm not mistaken, `alias` does _not_ accept invalid input, because the compiler ensures the given string matches the mangled name of another entity in the program. Now, if Clang creates an invalid mangling for that entity (due to, for example, an unchecked `abi_tag`), `alias` will also accept that invalid mangling.

Fair point, I was thinking in terms of compiler construction. We don't do that semantically, we do that during codegen: https://godbolt.org/z/PMaK431nv

But for `alias`, we can do that from codegen relatively easily. We can't do it for `abi_tag` though because we don't have an exposed interface for checking identifier validity outside of the lexer.

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


More information about the cfe-commits mailing list