| Ted Kremenek | 722398f | 2012-08-24 20:39:55 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core -analyzer-constraints=range -analyzer-store=region -verify -Wno-objc-root-class %s | 
| Andy Gibbs | c6e68da | 2012-10-19 12:44:48 +0000 | [diff] [blame] | 2 | // expected-no-diagnostics | 
| Ted Kremenek | e571c4ee | 2009-02-19 04:07:38 +0000 | [diff] [blame] | 3 |  | 
|  | 4 | typedef 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 |  | 
|  | 16 | void createFoo() { | 
|  | 17 | MyClass *obj = 0; | 
| Ted Kremenek | a98358e | 2011-10-28 19:05:10 +0000 | [diff] [blame] | 18 | Bar f = [obj foo]; // no-warning | 
| Ted Kremenek | e571c4ee | 2009-02-19 04:07:38 +0000 | [diff] [blame] | 19 | } | 
|  | 20 |  | 
| Ted Kremenek | 8b0dba3 | 2009-04-01 06:52:48 +0000 | [diff] [blame] | 21 | void createFoo2() { | 
|  | 22 | MyClass *obj = 0; | 
|  | 23 | [obj foo]; // no-warning | 
| Ted Kremenek | a98358e | 2011-10-28 19:05:10 +0000 | [diff] [blame] | 24 | Bar f = [obj foo]; // no-warning | 
| Ted Kremenek | 8b0dba3 | 2009-04-01 06:52:48 +0000 | [diff] [blame] | 25 | } | 
|  | 26 |  |