diff options
-rw-r--r-- | clang/lib/Analysis/CFRefCount.cpp | 6 | ||||
-rw-r--r-- | clang/test/Analysis/retain-release.m | 7 |
2 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp index b08bce1d58a..550410d66bf 100644 --- a/clang/lib/Analysis/CFRefCount.cpp +++ b/clang/lib/Analysis/CFRefCount.cpp @@ -1840,12 +1840,16 @@ void CFRefCount::EvalSummary(ExplodedNodeSet<GRState>& Dst, state.set<RefBindings>(Sym, RefVal::makeOwned(RE.getObjKind(), RetT)); state = state.BindExpr(Ex, loc::SymbolVal(Sym), false); - // FIXME: Add a flag to the checker where allocations are allowed to fail. + + // FIXME: Add a flag to the checker where allocations are assumed to + // *not fail. +#if 0 if (RE.getKind() == RetEffect::OwnedAllocatedSymbol) { bool isFeasible; state = state.Assume(loc::SymbolVal(Sym), true, isFeasible); assert(isFeasible && "Cannot assume fresh symbol is non-null."); } +#endif break; } diff --git a/clang/test/Analysis/retain-release.m b/clang/test/Analysis/retain-release.m index 6b131581196..c05d7304916 100644 --- a/clang/test/Analysis/retain-release.m +++ b/clang/test/Analysis/retain-release.m @@ -196,9 +196,8 @@ CFDateRef f8() { CFDateRef f9() { CFDateRef date = CFDateCreate(0, CFAbsoluteTimeGetCurrent()); int *p = 0; - // test that the checker assumes that CFDateCreate returns a non-null - // pointer - if (!date) *p = 1; // no-warning + // When allocations fail, CFDateCreate can return null. + if (!date) *p = 1; // expected-warning{{null}} return date; } @@ -316,7 +315,7 @@ static void rdar_6659160(char *inkind, char *inname) kindC = [kind UTF8String]; if(name) nameC = [name UTF8String]; - if(!isFoo(kindC[0])) // no-warning + if(!isFoo(kindC[0])) // expected-warning{{null}} return; if(!isFoo(nameC[0])) // no-warning return; |