r247612 - [Static Analyzer] Nullability checker optimization.

Gabor Horvath via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 14 13:31:47 PDT 2015


Author: xazax
Date: Mon Sep 14 15:31:46 2015
New Revision: 247612

URL: http://llvm.org/viewvc/llvm-project?rev=247612&view=rev
Log:
[Static Analyzer] Nullability checker optimization.

Differential Revision: http://reviews.llvm.org/D12848


Modified:
    cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp?rev=247612&r1=247611&r2=247612&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp Mon Sep 14 15:31:46 2015
@@ -406,12 +406,17 @@ void NullabilityChecker::reportBugIfPrec
 /// 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);
     }
   }




More information about the cfe-commits mailing list