blob: 3f3c778779f709ec7a71791334d1847670114009 [file] [log] [blame]
Ted Kremenekcdc3a892012-08-24 20:39:55 +00001// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core -analyzer-constraints=range -analyzer-store=region -verify -Wno-objc-root-class %s
Ted Kremenek98f1e1c2009-02-19 04:07:38 +00002
3typedef struct Foo { int x; } Bar;
4
5@interface MyClass {}
6- (Bar)foo;
7@end
8@implementation MyClass
9- (Bar)foo {
10 struct Foo f = { 0 };
11 return f;
12}
13@end
14
15void createFoo() {
16 MyClass *obj = 0;
Ted Kremenek4a037c72011-10-28 19:05:10 +000017 Bar f = [obj foo]; // no-warning
Ted Kremenek98f1e1c2009-02-19 04:07:38 +000018}
19
Ted Kremenekb930d7a2009-04-01 06:52:48 +000020void createFoo2() {
21 MyClass *obj = 0;
22 [obj foo]; // no-warning
Ted Kremenek4a037c72011-10-28 19:05:10 +000023 Bar f = [obj foo]; // no-warning
Ted Kremenekb930d7a2009-04-01 06:52:48 +000024}
25