[analyzer] Don't try to inline if there's no region for a message receiver.

While usually we'd use a symbolic region rather than a straight-up Unknown,
we can still generate unknowns via array subscripts with symbolic indexes.
(And if this ever changes in the future, we still shouldn't crash.)

llvm-svn: 161059
This commit is contained in:
Jordan Rose 2012-07-31 18:04:53 +00:00
parent 1f8c0b4587
commit 6a97d92ef5
2 changed files with 10 additions and 1 deletions

View File

@ -681,6 +681,9 @@ const Decl *ObjCMethodCall::getRuntimeDefinition() const {
ReceiverT = cast<ObjCObjectPointerType>(SupersType.getTypePtr());
} else {
const MemRegion *Receiver = getReceiverSVal().getAsRegion();
if (!Receiver)
return 0;
DynamicTypeInfo TI = getState()->getDynamicTypeInfo(Receiver);
ReceiverT = dyn_cast<ObjCObjectPointerType>(TI.getType().getTypePtr());
}

View File

@ -77,4 +77,10 @@
- (int) method2 {
return 5/_attribute; // expected-warning {{Division by zero}}
}
@end
@end
// Don't crash if we don't know the receiver's region.
void randomlyMessageAnObject(MyClass *arr[], int i) {
(void)[arr[i] getInt];
}