retain/release checker: More diagnostic refactoring.
llvm-svn: 63179
This commit is contained in:
parent
c4118ac79c
commit
758fda632b
|
|
@ -2331,36 +2331,24 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode<GRState>* N,
|
||||||
|
|
||||||
Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
|
Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
|
||||||
|
|
||||||
if (CurrV.isOwned()) {
|
|
||||||
if (CallExpr *CE = dyn_cast<CallExpr>(S)) {
|
if (CallExpr *CE = dyn_cast<CallExpr>(S)) {
|
||||||
// Get the name of the callee (if it is available).
|
// Get the name of the callee (if it is available).
|
||||||
SVal X = CurrSt.GetSVal(CE->getCallee());
|
SVal X = CurrSt.GetSVal(CE->getCallee());
|
||||||
|
|
||||||
if (loc::FuncVal* FV = dyn_cast<loc::FuncVal>(&X))
|
if (loc::FuncVal* FV = dyn_cast<loc::FuncVal>(&X))
|
||||||
os << "Call to function '" << FV->getDecl()->getNameAsString() <<'\'';
|
os << "Call to function '" << FV->getDecl()->getNameAsString() <<'\'';
|
||||||
else
|
else
|
||||||
os << "Function call";
|
os << "function call";
|
||||||
|
|
||||||
os << " returns an object with a +1 retain count"
|
|
||||||
" (owning reference).";
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert (isa<ObjCMessageExpr>(S));
|
assert (isa<ObjCMessageExpr>(S));
|
||||||
os << "Method returns an object with a +1 retain count"
|
os << "Method returns an object with a ";
|
||||||
" (owning reference).";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CurrV.isOwned())
|
||||||
|
os << "+1 retain count (owning reference).";
|
||||||
else {
|
else {
|
||||||
assert (CurrV.isNotOwned());
|
assert (CurrV.isNotOwned());
|
||||||
|
os << "+0 retain count (non-owning reference).";
|
||||||
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).";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FullSourceLoc Pos(S->getLocStart(), BR.getContext().getSourceManager());
|
FullSourceLoc Pos(S->getLocStart(), BR.getContext().getSourceManager());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue