blob: 5af4776b32db591f4915ba632c9ffe965b6001f2 [file] [log] [blame]
Patrick Beardb2f68202012-04-06 18:12:22 +00001// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=basic -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