aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/BasicObjCFoundationChecks.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-14 17:39:48 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-14 17:39:48 +0000
commitd2f642b56e87493edfc3b0dab359b5e32d5f8a5e (patch)
treef291d4f32525eaccf48d60cedd2bda6d64700403 /lib/Analysis/BasicObjCFoundationChecks.cpp
parent2bf78fba7a37a42d4295999706053fdf4c9625e2 (diff)
Hooked up the dead-store checker to the BugReporter interface. Now dead-store
warnings are emitted as part of the warnings registered by GRSimpleVals. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49658 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BasicObjCFoundationChecks.cpp')
-rw-r--r--lib/Analysis/BasicObjCFoundationChecks.cpp35
1 files changed, 10 insertions, 25 deletions
diff --git a/lib/Analysis/BasicObjCFoundationChecks.cpp b/lib/Analysis/BasicObjCFoundationChecks.cpp
index e5a31bf50d..717f5b8d80 100644
--- a/lib/Analysis/BasicObjCFoundationChecks.cpp
+++ b/lib/Analysis/BasicObjCFoundationChecks.cpp
@@ -68,7 +68,9 @@ public:
SourceRange R;
public:
- Report(NilArg& Desc, ObjCMessageExpr* ME, unsigned Arg) : BugReport(Desc) {
+ Report(NilArg& Desc, ExplodedNode<ValueState>* N,
+ ObjCMessageExpr* ME, unsigned Arg)
+ : BugReport(Desc, N) {
Expr* E = ME->getArg(Arg);
R = E->getSourceRange();
@@ -90,22 +92,6 @@ public:
B = &R;
E = B+1;
}
-
- virtual PathDiagnosticPiece* getEndPath(ASTContext& Ctx,
- ExplodedNode<ValueState> *N) const {
-
- Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
-
- if (!S)
- return NULL;
-
- FullSourceLoc L(S->getLocStart(), Ctx.getSourceManager());
- PathDiagnosticPiece* P = new PathDiagnosticPiece(L, s);
-
- P->addRange(R);
-
- return P;
- }
};
};
@@ -115,7 +101,7 @@ class VISIBILITY_HIDDEN BasicObjCFoundationChecks : public GRSimpleAPICheck {
ASTContext &Ctx;
ValueStateManager* VMgr;
- typedef std::vector<std::pair<NodeTy*,BugReport*> > ErrorsTy;
+ typedef std::vector<BugReport*> ErrorsTy;
ErrorsTy Errors;
RVal GetRVal(ValueState* St, Expr* E) { return VMgr->GetRVal(St, E); }
@@ -134,7 +120,7 @@ public:
virtual ~BasicObjCFoundationChecks() {
for (ErrorsTy::iterator I = Errors.begin(), E = Errors.end(); I!=E; ++I)
- delete I->second;
+ delete *I;
}
virtual bool Audit(ExplodedNode<ValueState>* N);
@@ -143,12 +129,12 @@ public:
private:
- void AddError(NodeTy* N, BugReport* R) {
- Errors.push_back(std::make_pair(N, R));
+ void AddError(BugReport* R) {
+ Errors.push_back(R);
}
void WarnNilArg(NodeTy* N, ObjCMessageExpr* ME, unsigned Arg) {
- AddError(N, new NilArg::Report(Desc, ME, Arg));
+ AddError(new NilArg::Report(Desc, N, ME, Arg));
}
};
@@ -203,9 +189,8 @@ static inline bool isNil(RVal X) {
void BasicObjCFoundationChecks::EmitWarnings(BugReporter& BR) {
- for (ErrorsTy::iterator I=Errors.begin(), E=Errors.end(); I!=E; ++I)
-
- BR.EmitPathWarning(*I->second, I->first);
+ for (ErrorsTy::iterator I=Errors.begin(), E=Errors.end(); I!=E; ++I)
+ BR.EmitPathWarning(**I);
}
bool BasicObjCFoundationChecks::CheckNilArg(NodeTy* N, unsigned Arg) {