Index: lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp +++ lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp @@ -73,17 +73,21 @@ /// Note that this class is immutable, and new fields may only be added through /// constructor calls. class FieldChainInfo { +public: using FieldChain = llvm::ImmutableList; +private: + FieldChain::Factory &Factory; FieldChain Chain; const bool IsDereferenced = false; public: - FieldChainInfo() = default; + FieldChainInfo() = delete; + FieldChainInfo(FieldChain::Factory &F) : Factory(F) {} FieldChainInfo(const FieldChainInfo &Other, const bool IsDereferenced) - : Chain(Other.Chain), IsDereferenced(IsDereferenced) {} + : Factory(Other.Factory), Chain(Other.Chain), IsDereferenced(IsDereferenced) {} FieldChainInfo(const FieldChainInfo &Other, const FieldRegion *FR, const bool IsDereferenced = false); @@ -128,6 +132,7 @@ bool IsAnyFieldInitialized = false; + FieldChainInfo::FieldChain::Factory Factory; UninitFieldSet UninitFields; public: @@ -217,10 +222,6 @@ } // end of anonymous namespace -// Static variable instantionations. - -static llvm::ImmutableListFactory Factory; - // Utility function declarations. /// Returns the object that was constructed by CtorDecl, or None if that isn't @@ -355,7 +356,7 @@ CheckPointeeInitialization(CheckPointeeInitialization) {} const UninitFieldSet &FindUninitializedFields::getUninitFields() { - isNonUnionUninit(ObjectR, FieldChainInfo()); + isNonUnionUninit(ObjectR, FieldChainInfo(Factory)); if (!IsPedantic && !IsAnyFieldInitialized) UninitFields.clear();