[clang] Revert "[clang][NFC] Refactor flag enum caching (#210632)" (PR #223244)

Avi Kivity via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 13 11:37:21 PDT 2026


avikivity wrote:

> > ActOnEnumBody only runs for enum definitions that are parsed in the current translation unit, so an EnumDecl deserialized from a PCH never gets a cache entry and DenseMap::at() dereferences end(), crashing clang in builds without assertions.
> 
> Can we instead insert into the cache when deserializing from PCH? Is this also a problem for modules?


I'm afraid I don't know this code at all.

> 
> The change you want to revert is needed for another (in-flight) patch - to properly diagnose missing/invalid bitwise operators for scoped flag_enums, we need some sort of work list. The existing flag_enum cache was _almost_ usable for that, except that we previously didn't have any sorts of guarantees that it will be populated (since populating was done lazily).

IMO not breaking existing code takes precedence. Maybe I'm biased because it's my code that's getting broken.

> 
> Thanks for pointing this out though, I was not aware that this was missing one reachable path (that wasn't as visible before the followup cleanup wrt gnu::flag_enum, but is problematic either way).



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


More information about the cfe-commits mailing list