diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-04-11 20:11:19 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-04-11 20:11:19 +0000 |
commit | a0df99ff6fb7f86fbb55ebac52f64ab35497924a (patch) | |
tree | 1569b0e6df7d5e9344a12e8e517a82ecb91b066c /lib/Analysis/CFRefCount.cpp | |
parent | d6a07aaf62b40cdfbd96f6b874d02b06fc22d015 (diff) |
Changed behavior of how we handle "NULL" summaries: just call
GRSimpleVals::EvalCal(), and don't change reference counts.
Remove "getDoNothingSummary()", as a NULL summary does the same thing.
Added temporary hack for the "Get" rule for objects that return a pointer type:
treat them as non-owned CF objects.
Added test case to detect the release of a non-owned object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49555 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFRefCount.cpp')
-rw-r--r-- | lib/Analysis/CFRefCount.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index 1748e450a3..a115a71a2a 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -136,7 +136,6 @@ class CFRefSummaryManager { CFRefSummary* getPersistentSummary(ArgEffects* AE, RetEffect RE); - CFRefSummary* getDoNothingSummary(unsigned Args); void FillDoNothing(unsigned Args); @@ -366,16 +365,12 @@ void CFRefSummaryManager::FillDoNothing(unsigned Args) { ScratchArgs.push_back(DoNothing); } -CFRefSummary* CFRefSummaryManager::getDoNothingSummary(unsigned Args) { - FillDoNothing(Args); - return getPersistentSummary(getArgEffects(), RetEffect::MakeNoRet()); -} CFRefSummary* CFRefSummaryManager::getCFSummaryCreateRule(FunctionTypeProto* FT) { if (!isCFRefType(FT->getResultType())) - return getDoNothingSummary(FT->getNumArgs()); + return NULL; assert (ScratchArgs.empty()); @@ -389,8 +384,16 @@ CFRefSummaryManager::getCFSummaryCreateRule(FunctionTypeProto* FT) { CFRefSummary* CFRefSummaryManager::getCFSummaryGetRule(FunctionTypeProto* FT) { - if (!isCFRefType(FT->getResultType())) - return getDoNothingSummary(FT->getNumArgs()); + QualType RetTy = FT->getResultType(); + + // FIXME: For now we assume that all pointer types returned are referenced + // counted. Since this is the "Get" rule, we assume non-ownership, which + // works fine for things that are not reference counted. We do this because + // some generic data structures return "void*". We need something better + // in the future. + + if (!isCFRefType(RetTy) && !RetTy->isPointerType()) + return NULL; assert (ScratchArgs.empty()); @@ -659,7 +662,7 @@ void CFRefCount::EvalCall(ExplodedNodeSet<ValueState>& Dst, RefVal::Kind hasError = (RefVal::Kind) 0; if (!Summ) { - +#if 0 // This function has no summary. Invalidate all reference-count state // for arguments passed to this function, and also nuke the values of // arguments passed-by-reference. @@ -698,6 +701,10 @@ void CFRefCount::EvalCall(ExplodedNodeSet<ValueState>& Dst, Builder.MakeNode(Dst, CE, Pred, St); return; +#else + GRSimpleVals::EvalCall(Dst, Eng, Builder, CE, L, Pred); + return; +#endif } // This function has a summary. Evaluate the effect of the arguments. |