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

Matthias Wippich via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 13 11:24:37 PDT 2026


Tsche 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 instead? 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 cache 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).

Thanks for pointing this out though, I was not aware that this was missing one reachable path (that wasn't there before the followup cleanup wrt gnu::flag_enum).

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


More information about the cfe-commits mailing list