xref: /llvm-project/clang/test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m (revision ffe7950ebc62380c3afc7c71f454a1db3f6f5c76)
1// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core -verify -Wno-objc-root-class %s
2// expected-no-diagnostics
3
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(void) {
17  MyClass *obj = 0;
18  Bar f = [obj foo]; // no-warning
19}
20
21void createFoo2(void) {
22  MyClass *obj = 0;
23  [obj foo]; // no-warning
24  Bar f = [obj foo]; // no-warning
25}
26
27