[cfe-commits] r63179 - /cfe/trunk/lib/Analysis/CFRefCount.cpp

Ted Kremenek kremenek at apple.com
Tue Jan 27 21:15:02 PST 2009


Author: kremenek
Date: Tue Jan 27 23:15:02 2009
New Revision: 63179

URL: http://llvm.org/viewvc/llvm-project?rev=63179&view=rev
Log:
retain/release checker: More diagnostic refactoring.

Modified:
    cfe/trunk/lib/Analysis/CFRefCount.cpp

Modified: cfe/trunk/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFRefCount.cpp?rev=63179&r1=63178&r2=63179&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Tue Jan 27 23:15:02 2009
@@ -2331,36 +2331,24 @@
     
     Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
 
-    if (CurrV.isOwned()) {
-      if (CallExpr *CE = dyn_cast<CallExpr>(S)) {
-        // Get the name of the callee (if it is available).
-        SVal X = CurrSt.GetSVal(CE->getCallee());
-
-        if (loc::FuncVal* FV = dyn_cast<loc::FuncVal>(&X))
-          os << "Call to function '" << FV->getDecl()->getNameAsString() <<'\'';
-        else
-          os << "Function call";
-        
-        os << " returns an object with a +1 retain count"
-              " (owning reference).";
-      }
-      else {
-        assert (isa<ObjCMessageExpr>(S));
-        os << "Method returns an object with a +1 retain count"
-                " (owning reference).";
-      }
+    if (CallExpr *CE = dyn_cast<CallExpr>(S)) {
+      // Get the name of the callee (if it is available).
+      SVal X = CurrSt.GetSVal(CE->getCallee());        
+      if (loc::FuncVal* FV = dyn_cast<loc::FuncVal>(&X))
+        os << "Call to function '" << FV->getDecl()->getNameAsString() <<'\'';
+      else
+        os << "function call";
+    }          
+    else {
+      assert (isa<ObjCMessageExpr>(S));
+      os << "Method returns an object with a ";
     }
+    
+    if (CurrV.isOwned())
+        os << "+1 retain count (owning reference).";
     else {
       assert (CurrV.isNotOwned());
-      
-      if (isa<CallExpr>(S))
-        os << "Function call returns an object with a +0 retain count"
-              " (non-owning reference).";
-      else {
-        assert (isa<ObjCMessageExpr>(S));
-        os << "Method returns an object with a +0 retain count"
-              " (non-owning reference).";
-      }      
+      os << "+0 retain count (non-owning reference).";
     }
     
     FullSourceLoc Pos(S->getLocStart(), BR.getContext().getSourceManager());





More information about the cfe-commits mailing list