2012-08-25 04:39:55 +08:00
|
|
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core -analyzer-constraints=range -analyzer-store=region -verify -Wno-objc-root-class %s
|
2012-10-19 20:44:48 +08:00
|
|
|
// expected-no-diagnostics
|
2009-02-19 12:07:38 +08:00
|
|
|
|
|
|
|
typedef struct Foo { int x; } Bar;
|
|
|
|
|
|
|
|
@interface MyClass {}
|
|
|
|
- (Bar)foo;
|
|
|
|
@end
|
|
|
|
@implementation MyClass
|
|
|
|
- (Bar)foo {
|
|
|
|
struct Foo f = { 0 };
|
|
|
|
return f;
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
void createFoo() {
|
|
|
|
MyClass *obj = 0;
|
2011-10-29 03:05:10 +08:00
|
|
|
Bar f = [obj foo]; // no-warning
|
2009-02-19 12:07:38 +08:00
|
|
|
}
|
|
|
|
|
2009-04-01 14:52:48 +08:00
|
|
|
void createFoo2() {
|
|
|
|
MyClass *obj = 0;
|
|
|
|
[obj foo]; // no-warning
|
2011-10-29 03:05:10 +08:00
|
|
|
Bar f = [obj foo]; // no-warning
|
2009-04-01 14:52:48 +08:00
|
|
|
}
|
|
|
|
|