[cfe-commits] r165840 - /cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp

Ted Kremenek kremenek at apple.com
Fri Oct 12 15:56:40 PDT 2012


Author: kremenek
Date: Fri Oct 12 17:56:40 2012
New Revision: 165840

URL: http://llvm.org/viewvc/llvm-project?rev=165840&view=rev
Log:
Silence null dereference warnings by documenting context-specific
invariants using assertions.

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

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp?rev=165840&r1=165839&r2=165840&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp Fri Oct 12 17:56:40 2012
@@ -2203,6 +2203,7 @@
 
   // If allocation happened in a function different from the leak node context,
   // do not report the binding.
+  assert(N && "Could not find allocation node");
   if (N->getLocationContext() != LeakContext) {
     FirstBinding = 0;
   }
@@ -2258,6 +2259,7 @@
 
   // Get the retain count.
   const RefVal* RV = getRefBinding(EndN->getState(), Sym);
+  assert(RV);
 
   if (RV->getKind() == RefVal::ErrorLeakReturned) {
     // FIXME: Per comments in rdar://6320065, "create" only applies to CF
@@ -2855,6 +2857,7 @@
 
   // Consult the summary for the return value.
   RetEffect RE = Summ.getRetEffect();
+  assert(CallOrMsg.getOriginExpr());
 
   if (RE.getKind() == RetEffect::OwnedWhenTrackedReceiver) {
     if (ReceiverIsTracked)





More information about the cfe-commits mailing list