Index: include/clang/StaticAnalyzer/Core/CheckerManager.h =================================================================== --- include/clang/StaticAnalyzer/Core/CheckerManager.h +++ include/clang/StaticAnalyzer/Core/CheckerManager.h @@ -144,31 +144,18 @@ //===----------------------------------------------------------------------===// /// Used to register checkers. + /// All arguments are automatically passed through to the checker + /// constructor. /// /// \returns a pointer to the checker object. - template - CHECKER *registerChecker() { - CheckerTag tag = getTag(); - CheckerRef &ref = CheckerTags[tag]; - if (ref) - return static_cast(ref); // already registered. - - CHECKER *checker = new CHECKER(); - checker->Name = CurrentCheckName; - CheckerDtors.push_back(CheckerDtor(checker, destruct)); - CHECKER::_register(checker, *this); - ref = checker; - return checker; - } - - template - CHECKER *registerChecker(AnalyzerOptions &AOpts) { + template + CHECKER *registerChecker(AT... Args) { CheckerTag tag = getTag(); CheckerRef &ref = CheckerTags[tag]; if (ref) return static_cast(ref); // already registered. - CHECKER *checker = new CHECKER(AOpts); + CHECKER *checker = new CHECKER(Args...); checker->Name = CurrentCheckName; CheckerDtors.push_back(CheckerDtor(checker, destruct)); CHECKER::_register(checker, *this); Index: lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp +++ lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp @@ -56,6 +56,12 @@ check::PostStmt, check::PreObjCMessage, check::PostObjCMessage > { +private: + /// This value is set to true, when the Generics checker is turned on. + bool CheckGenerics; +public: + DynamicTypePropagation(bool CheckGenerics) + : CheckGenerics(CheckGenerics) {} const ObjCObjectType *getObjectTypeForAllocAndNew(const ObjCMessageExpr *MsgE, CheckerContext &C) const; @@ -107,9 +113,6 @@ void checkDeadSymbols(SymbolReaper &SR, CheckerContext &C) const; void checkPreObjCMessage(const ObjCMethodCall &M, CheckerContext &C) const; void checkPostObjCMessage(const ObjCMethodCall &M, CheckerContext &C) const; - - /// This value is set to true, when the Generics checker is turned on. - DefaultBool CheckGenerics; }; } // end anonymous namespace @@ -995,11 +998,9 @@ /// Register checkers. void ento::registerObjCGenericsChecker(CheckerManager &mgr) { - DynamicTypePropagation *checker = - mgr.registerChecker(); - checker->CheckGenerics = true; + mgr.registerChecker(/*CheckGenerics=*/true); } void ento::registerDynamicTypePropagation(CheckerManager &mgr) { - mgr.registerChecker(); + mgr.registerChecker(/*CheckGenerics=*/false); }