================ @@ -351,12 +356,30 @@ void DereferenceChecker::checkBind(SVal L, SVal V, const Stmt *S, C.addTransition(State, this); } -void ento::registerDereferenceChecker(CheckerManager &mgr) { - auto *Chk = mgr.registerChecker<DereferenceChecker>(); - Chk->SuppressAddressSpaces = mgr.getAnalyzerOptions().getCheckerBooleanOption( - mgr.getCurrentCheckerName(), "SuppressAddressSpaces"); +void ento::registerDereferenceModeling(CheckerManager &Mgr) { + Mgr.registerChecker<DereferenceChecker>(); +} + +bool ento::shouldRegisterDereferenceModeling(const CheckerManager &Mgr) { + return true; +} + +void ento::registerNullDereferenceChecker(CheckerManager &Mgr) { + auto *Chk = Mgr.getChecker<DereferenceChecker>(); + Chk->CheckNullDereference = true; + Chk->SuppressAddressSpaces = Mgr.getAnalyzerOptions().getCheckerBooleanOption( + Mgr.getCurrentCheckerName(), "SuppressAddressSpaces"); + Chk->BT_Null.reset(new BugType(Mgr.getCurrentCheckerName(), + "Dereference of null pointer", + categories::LogicError)); + Chk->BT_Undef.reset(new BugType(Mgr.getCurrentCheckerName(), + "Dereference of undefined pointer value", + categories::LogicError)); + Chk->BT_Label.reset(new BugType(Mgr.getCurrentCheckerName(), + "Dereference of the address of a label", ---------------- NagyDonat wrote:
It's a pity that this commit reintroduces this dynamic initialization boilerplate. We should really introduce a clear framework for supporting bug types in a checker class that implements multiple sub-checkers... (This is just a general long-term complaint, your change is probably the best possible short-term solution...) https://github.com/llvm/llvm-project/pull/122139 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits