forked from OSchip/llvm-project
[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:
parent
1f8c0b4587
commit
6a97d92ef5
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
}
|
Loading…
Reference in New Issue