xazax.hun created this revision. xazax.hun added reviewers: dcoughlin, zaks.anna, jordan_rose. xazax.hun added a subscriber: cfe-commits.
Right now the nullability checker only tracks symbolic regions. For this reason if there are no dead symbols it is safe to skip the precondition checking. I also changed to cleanup code to work with symbols directly instead of memory regions. http://reviews.llvm.org/D12848 Files: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp Index: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp +++ lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp @@ -395,12 +395,17 @@ /// Cleaning up the program state. void NullabilityChecker::checkDeadSymbols(SymbolReaper &SR, CheckerContext &C) const { + if (!SR.hasDeadSymbols()) + return; + ProgramStateRef State = C.getState(); NullabilityMapTy Nullabilities = State->get<NullabilityMap>(); for (NullabilityMapTy::iterator I = Nullabilities.begin(), E = Nullabilities.end(); I != E; ++I) { - if (!SR.isLiveRegion(I->first)) { + const auto *Region = I->first->getAs<SymbolicRegion>(); + assert(Region && "Non-symbolic region is tracked."); + if (SR.isDead(Region->getSymbol())) { State = State->remove<NullabilityMap>(I->first); } }
Index: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp +++ lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp @@ -395,12 +395,17 @@ /// Cleaning up the program state. void NullabilityChecker::checkDeadSymbols(SymbolReaper &SR, CheckerContext &C) const { + if (!SR.hasDeadSymbols()) + return; + ProgramStateRef State = C.getState(); NullabilityMapTy Nullabilities = State->get<NullabilityMap>(); for (NullabilityMapTy::iterator I = Nullabilities.begin(), E = Nullabilities.end(); I != E; ++I) { - if (!SR.isLiveRegion(I->first)) { + const auto *Region = I->first->getAs<SymbolicRegion>(); + assert(Region && "Non-symbolic region is tracked."); + if (SR.isDead(Region->getSymbol())) { State = State->remove<NullabilityMap>(I->first); } }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits