summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CFRefCount.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-12-03 08:25:47 +0000
committerTed Kremenek <kremenek@apple.com>2009-12-03 08:25:47 +0000
commit5bee5c4ff0a5e78262b029ca8102b63f49b50602 (patch)
treea81dc573386c610638ceab212626767fab2805b0 /clang/lib/Analysis/CFRefCount.cpp
parent4a815fc82eb3ec115f61df4c251d26f6fda92b52 (diff)
downloadbcm5719-llvm-5bee5c4ff0a5e78262b029ca8102b63f49b50602.tar.gz
bcm5719-llvm-5bee5c4ff0a5e78262b029ca8102b63f49b50602.zip
Add value invalidation logic for block-captured variables. Conceptually invoking a block (without specific reasoning of what the block does) can invalidate any value to it by reference when the block was created.
llvm-svn: 90431
Diffstat (limited to 'clang/lib/Analysis/CFRefCount.cpp')
-rw-r--r--clang/lib/Analysis/CFRefCount.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp
index 0b69a4c5ae3..288645d2272 100644
--- a/clang/lib/Analysis/CFRefCount.cpp
+++ b/clang/lib/Analysis/CFRefCount.cpp
@@ -1984,6 +1984,7 @@ public:
Expr* Ex,
Expr* Receiver,
const RetainSummary& Summ,
+ const MemRegion *Callee,
ExprIterator arg_beg, ExprIterator arg_end,
ExplodedNode* Pred, const GRState *state);
@@ -2777,6 +2778,7 @@ void CFRefCount::EvalSummary(ExplodedNodeSet& Dst,
Expr* Ex,
Expr* Receiver,
const RetainSummary& Summ,
+ const MemRegion *Callee,
ExprIterator arg_beg, ExprIterator arg_end,
ExplodedNode* Pred, const GRState *state) {
@@ -2856,6 +2858,12 @@ void CFRefCount::EvalSummary(ExplodedNodeSet& Dst,
}
}
+ // Block calls result in all captured values passed-via-reference to be
+ // invalidated.
+ if (const BlockDataRegion *BR = dyn_cast_or_null<BlockDataRegion>(Callee)) {
+ RegionsToInvalidate.push_back(BR);
+ }
+
// Invalidate regions we designed for invalidation use the batch invalidation
// API.
if (!RegionsToInvalidate.empty()) {
@@ -3025,7 +3033,7 @@ void CFRefCount::EvalCall(ExplodedNodeSet& Dst,
}
assert(Summ);
- EvalSummary(Dst, Eng, Builder, CE, 0, *Summ,
+ EvalSummary(Dst, Eng, Builder, CE, 0, *Summ, L.getAsRegion(),
CE->arg_begin(), CE->arg_end(), Pred, Builder.GetState(Pred));
}
@@ -3041,7 +3049,7 @@ void CFRefCount::EvalObjCMessageExpr(ExplodedNodeSet& Dst,
: Summaries.getClassMethodSummary(ME);
assert(Summ && "RetainSummary is null");
- EvalSummary(Dst, Eng, Builder, ME, ME->getReceiver(), *Summ,
+ EvalSummary(Dst, Eng, Builder, ME, ME->getReceiver(), *Summ, NULL,
ME->arg_begin(), ME->arg_end(), Pred, state);
}
OpenPOWER on IntegriCloud