[cfe-commits] r162949 - in /cfe/trunk: include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp test/Analysis/inlining/assume-super-init-does-not-return-nil.m

Anna Zaks ganna at apple.com
Thu Aug 30 15:42:41 PDT 2012


Author: zaks
Date: Thu Aug 30 17:42:41 2012
New Revision: 162949

URL: http://llvm.org/viewvc/llvm-project?rev=162949&view=rev
Log:
[analyzer] Fixup for r162935 as per Jordan's review.

Thanks for catching this!

Modified:
    cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
    cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
    cfe/trunk/test/Analysis/inlining/assume-super-init-does-not-return-nil.m

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h?rev=162949&r1=162948&r2=162949&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h Thu Aug 30 17:42:41 2012
@@ -102,7 +102,7 @@
 
   /// Returns true if the predecessor is within an inlined function/method.
   bool isWithinInlined() {
-    return (getStackFrame() != 0);
+    return (getStackFrame()->getParent() != 0);
   }
 
   BugReporter &getBugReporter() {

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp?rev=162949&r1=162948&r2=162949&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp Thu Aug 30 17:42:41 2012
@@ -736,9 +736,9 @@
                                     ProgramStateRef State,
                                     CheckerContext &C) {
   SVal Val = State->getSVal(NonNullExpr, C.getLocationContext());
-  if (!isa<DefinedOrUnknownSVal>(Val))
-    return State;
-  return State->assume(cast<DefinedOrUnknownSVal>(Val), true);
+  if (DefinedOrUnknownSVal *DV = dyn_cast<DefinedOrUnknownSVal>(&Val))
+    return State->assume(cast<DefinedOrUnknownSVal>(*DV), true);
+  return State;
 }
 
 void ObjCNonNilReturnValueChecker::checkPostObjCMessage(const ObjCMethodCall &M,

Modified: cfe/trunk/test/Analysis/inlining/assume-super-init-does-not-return-nil.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/inlining/assume-super-init-does-not-return-nil.m?rev=162949&r1=162948&r2=162949&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/inlining/assume-super-init-does-not-return-nil.m (original)
+++ cfe/trunk/test/Analysis/inlining/assume-super-init-does-not-return-nil.m Thu Aug 30 17:42:41 2012
@@ -24,7 +24,7 @@
 @implementation Cell
 - (id) init {
   if ((self = [super init])) {
-    ;
+    return self;
   }
   // Test that this is being analyzed.
   int m;





More information about the cfe-commits mailing list