diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-05-07 21:49:45 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-05-07 21:49:45 +0000 |
commit | 7704a33fb398a4352a18bd3fcb18218d3dc5cc60 (patch) | |
tree | 57fade7061f94ba8c36e66046456d653d3fb0fb5 /lib/Analysis/GRExprEngineInternalChecks.cpp | |
parent | cae27c51f0da674cdd3b53b8b2f7ba08c44c54b0 (diff) |
More attribute renaming:
- Rename 'ns_returns_owned' -> 'ns_returns_retained'.
- Rename 'cf_returns_owned' -> 'cf_returns_retained'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71182 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/GRExprEngineInternalChecks.cpp')
-rw-r--r-- | lib/Analysis/GRExprEngineInternalChecks.cpp | 70 |
1 files changed, 67 insertions, 3 deletions
diff --git a/lib/Analysis/GRExprEngineInternalChecks.cpp b/lib/Analysis/GRExprEngineInternalChecks.cpp index 541282da3e..cca1c68cf7 100644 --- a/lib/Analysis/GRExprEngineInternalChecks.cpp +++ b/lib/Analysis/GRExprEngineInternalChecks.cpp @@ -525,6 +525,65 @@ public: //===----------------------------------------------------------------------===// namespace { +#if 0 +class VISIBILITY_HIDDEN TrackValueBRVisitor : public BugReporterVisitor { + SVal V; + Stmt *S; + const MemRegion *R; +public: + TrackValueBRVisitor(SVal v, Stmt *s) : V(v), S(s), R(0) {} + + PathDiagnosticPiece* VisitNode(const ExplodedNode<GRState> *N, + const ExplodedNode<GRState> *PrevN, + BugReporterContext& BRC) { + + // Not at a expression? + if (!isa<PostStmt>(N->getLocation())) { + S = 0; + return NULL; + } + + if (S) + return VisitNodeExpr(N, PrevN, BRC); + else if (R) + return VisitNodeRegion(N, PrevN, BRC); + + return NULL; + } + + PathDiagnosticPiece* VisitNodeExpr(const ExplodedNode<GRState> *N, + const ExplodedNode<GRState> *PrevN, + BugReporterContext& BRC) { + + assert(S); + PostStmt P = cast<PostStmt>(N->getLocation()); + Stmt *X = P.getStmt(); + + // Generate the subexpression path. + llvm::SmallVector<Stmt*, 4> SubExprPath; + ParentMap &PM = BRC.getParentMap(); + + for ( ; X && X != S ; X = X.getParent(X)) { + if (isa<ParenExpr>(X)) + continue; + + SubExprPath.push_back(L); + } + + // Lost track? (X is not a subexpression of S). + if (X != S) { + S = NULL; + return NULL; + } + + // Now go down the subexpression path! + + + + } +}; +#endif + class VISIBILITY_HIDDEN TrackConstraintBRVisitor : public BugReporterVisitor { SVal Constraint; const bool Assumption; @@ -533,8 +592,8 @@ public: TrackConstraintBRVisitor(SVal constraint, bool assumption) : Constraint(constraint), Assumption(assumption), isSatisfied(false) {} - PathDiagnosticPiece* VisitNode(const ExplodedNode<GRState>* N, - const ExplodedNode<GRState>* PrevN, + PathDiagnosticPiece* VisitNode(const ExplodedNode<GRState> *N, + const ExplodedNode<GRState> *PrevN, BugReporterContext& BRC) { if (isSatisfied) return NULL; @@ -624,7 +683,7 @@ static void registerTrackNullValue(BugReporterContext& BRC, // base value that was dereferenced. // assert(!V.isUnknownOrUndef()); - // For now just track when a symbolic value became null. + // Is it a symbolic value? if (loc::MemRegionVal *L = dyn_cast<loc::MemRegionVal>(&V)) { const SubRegion *R = cast<SubRegion>(L->getRegion()); while (R && !isa<SymbolicRegion>(R)) { @@ -634,8 +693,13 @@ static void registerTrackNullValue(BugReporterContext& BRC, if (R) { assert(isa<SymbolicRegion>(R)); registerTrackConstraint(BRC, loc::MemRegionVal(R), false); +// registerTrackValue(BRC, S, V, N); } } + + // Was it a hard integer? +// if (isa<nonloc::ConcreteInt>(V)) +// registerTrackValue(BRC, S, V, N); } //===----------------------------------------------------------------------===// |