r344312 - [analyzer] Avoid unneeded invalidation in RetainCountChecker

George Karpenkov via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 11 15:59:38 PDT 2018


Author: george.karpenkov
Date: Thu Oct 11 15:59:38 2018
New Revision: 344312

URL: http://llvm.org/viewvc/llvm-project?rev=344312&view=rev
Log:
[analyzer] Avoid unneeded invalidation in RetainCountChecker

Differential Revision: https://reviews.llvm.org/D53168

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

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp?rev=344312&r1=344311&r2=344312&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp Thu Oct 11 15:59:38 2018
@@ -802,25 +802,6 @@ bool RetainCountChecker::evalCall(const
   }
   state = state->BindExpr(CE, LCtx, RetVal, false);
 
-  // FIXME: This should not be necessary, but otherwise the argument seems to be
-  // considered alive during the next statement.
-  if (const MemRegion *ArgRegion = RetVal.getAsRegion()) {
-    // Save the refcount status of the argument.
-    SymbolRef Sym = RetVal.getAsLocSymbol();
-    const RefVal *Binding = nullptr;
-    if (Sym)
-      Binding = getRefBinding(state, Sym);
-
-    // Invalidate the argument region.
-    state = state->invalidateRegions(
-        ArgRegion, CE, C.blockCount(), LCtx,
-        /*CausesPointerEscape*/ hasTrustedImplementationAnnotation);
-
-    // Restore the refcount status of the argument.
-    if (Binding)
-      state = setRefBinding(state, Sym, *Binding);
-  }
-
   C.addTransition(state);
   return true;
 }




More information about the cfe-commits mailing list