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;
}
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;
}
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;