diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-01-28 05:15:02 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-01-28 05:15:02 +0000 |
commit | 5c1cd520dbca6d5476fb46414b7cf93d3a5afdf4 (patch) | |
tree | dd65f0e83ae0060a742bc8504dc514531e116d04 /lib/Analysis/CFRefCount.cpp | |
parent | 20982803252c1ded98536228c70709a027fe094d (diff) |
retain/release checker: More diagnostic refactoring.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63179 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFRefCount.cpp')
-rw-r--r-- | lib/Analysis/CFRefCount.cpp | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index d3cf89caa4..a042b909e1 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -2331,36 +2331,24 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode<GRState>* N, 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()); |