From e6a2780c96d0f21cdf6aecf16bbc3f38ecee519b Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Wed, 25 Nov 2009 01:35:18 +0000 Subject: Add really basic support for blocks in the retain/release checker. For now, anytime we pass a tracked object to a block call we stop tracking it. llvm-svn: 89831 --- clang/lib/Analysis/CFRefCount.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'clang/lib/Analysis') diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp index 433e350accc..c0d306d57cd 100644 --- a/clang/lib/Analysis/CFRefCount.cpp +++ b/clang/lib/Analysis/CFRefCount.cpp @@ -3052,9 +3052,20 @@ void CFRefCount::EvalCall(ExplodedNodeSet& Dst, GRStmtNodeBuilder& Builder, CallExpr* CE, SVal L, ExplodedNode* Pred) { - const FunctionDecl* FD = L.getAsFunctionDecl(); - RetainSummary* Summ = !FD ? Summaries.getDefaultSummary() - : Summaries.getSummary(const_cast(FD)); + + RetainSummary *Summ = 0; + + // FIXME: Better support for blocks. For now we stop tracking anything + // that is passed to blocks. + // FIXME: Need to handle variables that are "captured" by the block. + if (dyn_cast_or_null(L.getAsRegion())) { + Summ = Summaries.getPersistentStopSummary(); + } + else { + const FunctionDecl* FD = L.getAsFunctionDecl(); + Summ = !FD ? Summaries.getDefaultSummary() : + Summaries.getSummary(const_cast(FD)); + } assert(Summ); EvalSummary(Dst, Eng, Builder, CE, 0, *Summ, -- cgit v1.2.3