[clang] [analyzer] Enforce not making overly complicated symbols (PR #144327)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 24 08:03:18 PDT 2025


================
@@ -51,18 +51,18 @@ class SymExpr : public llvm::FoldingSetNode {
   /// Note, however, that it can't be used in Profile because SymbolManager
   /// needs to compute Profile before allocating SymExpr.
   const SymbolID Sym;
+  const unsigned Complexity;
 
 protected:
-  SymExpr(Kind k, SymbolID Sym) : K(k), Sym(Sym) {}
+  SymExpr(Kind k, SymbolID Sym, unsigned Complexity)
+      : K(k), Sym(Sym), Complexity(Complexity) {}
 
   static bool isValidTypeForSymbol(QualType T) {
     // FIXME: Depending on whether we choose to deprecate structural symbols,
     // this may become much stricter.
     return !T.isNull() && !T->isVoidType();
   }
 
-  mutable unsigned Complexity = 0;
----------------
NagyDonat wrote:

Oh, I didn't notice this side effect previously, but it's always nice to get rid of superfluous `mutable` stuff.

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


More information about the cfe-commits mailing list