[clang] [Clang] speed up -Wassign-enum via enumerator caching (PR #176560)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 29 05:10:14 PST 2026


================
@@ -3544,6 +3544,10 @@ class Sema final : public SemaBase {
   /// attribute.
   mutable llvm::DenseMap<const EnumDecl *, llvm::APInt> FlagBitsCache;
 
+  /// A cache of enumerator values for enums checked by -Wassign-enum.
+  llvm::DenseMap<const EnumDecl *, llvm::SmallVector<llvm::APSInt, 64>>
----------------
AaronBallman wrote:

`64` seems quite large for a small vector holding enumerator values (most enumerations would likely have far fewer enumerators, I would guess); would it make more sense for this to be a smaller value? Like 4 or 8?

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


More information about the cfe-commits mailing list