[clang] [Clang] Emit TBAA info for enums in C (PR #73326)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 5 11:24:18 PST 2023


efriedma-quic wrote:

The C notion of "compatibility" with regard to enums is a bit weird... clang and gcc disagree whether `enum e : int; enum e2: int; enum e x; int x; enum e2 x;` is valid because 6.2.7 doesn't actually define what's supposed to happen.  Probably this should be illegal, but the standard isn't really clear here.  Maybe it should be clarified to have a notion of "redeclaration compatibility" which is separate from general type compatibility.

That said, this patch is pretty conservative; it's hard for me to imagine treating an enum as the underlying type could cause any issues (unless code is assuming an enum has universal aliasing).

I guess this should be compatible with older clang versions, so we don't need to rev the version of TBAA data.

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


More information about the cfe-commits mailing list