[PATCH] D12848: [Static Analyzer] Nullability checker optimization.
Gábor Horváth via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 14 10:00:17 PDT 2015
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);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12848.34693.patch
Type: text/x-patch
Size: 990 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150914/b36acd5e/attachment.bin>
More information about the cfe-commits
mailing list