[clang] [clang] Implement gcc_struct attribute on Itanium targets (PR #71148)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 11 07:03:57 PST 2025


Martin =?utf-8?q?Storsjö?= <martin at martin.st>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/71148 at github.com>


erichkeane wrote:

> > Oof. I didn't realize we had that as a pragma. :-/ Yeah, I think the expected priority is: local takes precedence over pragma takes precedence over command line. So you may have to do the exclusion the hard way (manually).
> 
> Thanks! Yes, such an order of precedence seems reasonable.
> 
> As the pragma seems to show up in the form of an attribute at the level of `AST/Decl.cpp`, at what level should I check this to be able to distinguish pragma+attribute vs attribute+attribute?

I haven't spent any time with that pragma, but best I can tell is that the pragma creates it (SemaAttr.cpp ~92) as 'implicit'.  

I DO wonder if we should have some sort of fix to the `MutualExclusion` logic as table-gen'ed to allow `explicit > implicit`.  There is some additional work then to make sure that the explicit wins in codegen in this case (OR, we have it remove the implict/skip the implicit add at that point?) so that only 1 shows up in the AST.

Otherwise, you'd need a custom `handleXXXAttr` (remove the `hasSimpleHandler` from Attr.td, then add handlers to SemaDeclAttr.cpp) that do the checks.

Obviously the 'implicit' one is added in a different step, so that probably should check to make sure it isn't adding if the GCC one already is though.

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


More information about the cfe-commits mailing list