blob: 74d5484fae8b668cc7bc5a14fa813ff8c8d38db5 [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
Andy Gibbs8e8fb3b2012-10-19 12:44:48 +00002// expected-no-diagnostics
Ted Kremenek98f1e1c2009-02-19 04:07:38 +00003
4typedef struct Foo { int x; } Bar;
5
6@interface MyClass {}
7- (Bar)foo;
8@end
9@implementation MyClass
10- (Bar)foo {
11 struct Foo f = { 0 };
12 return f;
13}
14@end
15
16void createFoo() {
17 MyClass *obj = 0;
Ted Kremenek4a037c72011-10-28 19:05:10 +000018 Bar f = [obj foo]; // no-warning
Ted Kremenek98f1e1c2009-02-19 04:07:38 +000019}
20
Ted Kremenekb930d7a2009-04-01 06:52:48 +000021void createFoo2() {
22 MyClass *obj = 0;
23 [obj foo]; // no-warning
Ted Kremenek4a037c72011-10-28 19:05:10 +000024 Bar f = [obj foo]; // no-warning
Ted Kremenekb930d7a2009-04-01 06:52:48 +000025}
26