Fariborz Jahanian | be1d4ec | 2012-08-10 15:54:40 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -x objective-c++ -fsyntax-only -Werror -verify -Wno-objc-root-class %s |
Andy Gibbs | 8e8fb3b | 2012-10-19 12:44:48 +0000 | [diff] [blame] | 2 | // expected-no-diagnostics |
Fariborz Jahanian | be1d4ec | 2012-08-10 15:54:40 +0000 | [diff] [blame] | 3 | // rdar://10387088 |
| 4 | |
| 5 | @interface MyClass |
| 6 | - (void)someMethod; |
| 7 | @end |
| 8 | |
| 9 | struct S { |
| 10 | int bar(MyClass * myObject); |
| 11 | |
| 12 | int gorfbar(MyClass * myObject); |
| 13 | |
Fariborz Jahanian | 9e5df31 | 2012-08-10 21:15:06 +0000 | [diff] [blame] | 14 | S(); |
| 15 | S(MyClass *O1, MyClass *O2); |
| 16 | S(MyClass *O1); |
| 17 | |
| 18 | MyClass * Obj1, *Obj2; |
| 19 | |
Fariborz Jahanian | be1d4ec | 2012-08-10 15:54:40 +0000 | [diff] [blame] | 20 | }; |
| 21 | |
| 22 | @implementation MyClass |
| 23 | - (void)someMethod { |
| 24 | [self privateMethod]; // clang already does not warn here |
| 25 | } |
| 26 | |
| 27 | int S::bar(MyClass * myObject) { |
| 28 | [myObject privateMethod]; |
| 29 | return gorfbar(myObject); |
| 30 | } |
| 31 | - (void)privateMethod { } |
| 32 | |
| 33 | int S::gorfbar(MyClass * myObject) { |
| 34 | [myObject privateMethod]; |
| 35 | [myObject privateMethod1]; |
| 36 | return getMe + bar(myObject); |
| 37 | } |
| 38 | |
Fariborz Jahanian | 9e5df31 | 2012-08-10 21:15:06 +0000 | [diff] [blame] | 39 | S::S(MyClass *O1, MyClass *O2) : Obj1(O1), Obj2(O2) { |
| 40 | [O1 privateMethod]; |
| 41 | [O2 privateMethod1]; |
| 42 | } |
| 43 | S::S(MyClass *O1) : Obj1(O1){ Obj2 = 0; } |
| 44 | |
| 45 | S::S() {} |
| 46 | |
Fariborz Jahanian | be1d4ec | 2012-08-10 15:54:40 +0000 | [diff] [blame] | 47 | - (void)privateMethod1 { |
| 48 | getMe = getMe+1; |
| 49 | } |
| 50 | |
| 51 | static int getMe; |
| 52 | |
| 53 | @end |