[clang] [Frontend][Sema] Add CC1-only -fms-anonymous-structs to enable Microsoft anonymous struct/union feature (PR #176551)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 26 05:30:42 PST 2026


AaronBallman wrote:

> LGTM with minor nits; however, we still have the open question of whether this should be a CC1-only option.
> 
> @MaskRay, do you have an opinion on whether this should be exposed via a Clang driver option (with or without a negative form)?

CC @rnk @zmodem as other folks interested in Windows behaviors.

> I think this makes sense to leave as a `-cc1`-only option for now. It's always easy to promote this to a driver option, but pretty much impossible to remove once it's in the driver.

FWIW, I'm starting to feel pretty strongly about this not being a cc1-only flag. We do not want to condition users to do `-Xclang -some-option` for controlling language dialects.  So to me, if this is important enough for users to be able to control explicitly, it should be a driver flag. (The situation where I think a cc1-only flag would be a good idea is if your downstream driver was going to enable this automatically for users so the user doesn't have to do the `-Xclang` dance, but I don't have the impression that's the case here.)

I looked through Microsoft's documentation and could not find a `/Zc` or other flag to control this behavior in cl, so I don't think a driver option would require any changes for clang-cl.

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


More information about the cfe-commits mailing list