1// RUN: %clang_cc1 %s -verify -fsyntax-only -Wno-objc-root-class 2 3class ClassA {}; 4 5class ClassB { 6public: 7 ClassB(ClassA* parent=0); 8 ~ClassB(); 9}; 10 11@interface NSObject 12@end 13 14@interface InterfaceA : NSObject 15@property(nonatomic, assign) ClassA *m_prop1; // expected-note {{here}} 16@property(nonatomic, assign) ClassB *m_prop2; 17@end 18 19@implementation InterfaceA 20- (id)test { 21 self.m_prop2 = new ClassB(m_prop1); // expected-error {{use of undeclared identifier 'm_prop1'; did you mean '_m_prop1'?}} 22} 23@end 24 25@interface InvalidNameInIvarAndPropertyBase 26{ 27@public 28 float _a; 29} 30@property float _b; 31@end 32 33void invalidNameInIvarAndPropertyBase() { 34 float a = ((InvalidNameInIvarAndPropertyBase*)node)->_a; // expected-error {{use of undeclared identifier 'node'}} 35 float b = ((InvalidNameInIvarAndPropertyBase*)node)._b; // expected-error {{use of undeclared identifier 'node'}} 36} 37 38// Typo correction for a property when it has as correction candidates 39// synthesized ivar and a class name, both at the same edit distance. 40@class TypoCandidate; 41 42@interface PropertyType : NSObject 43@property int x; 44@end 45 46@interface InterfaceC : NSObject 47@property(assign) PropertyType *typoCandidate; // expected-note {{'_typoCandidate' declared here}} 48@end 49 50@implementation InterfaceC 51-(void)method { 52 typoCandidate.x = 0; // expected-error {{use of undeclared identifier 'typoCandidate'; did you mean '_typoCandidate'?}} 53} 54@end 55 56// The scope of 'do-while' ends before typo-correction takes place. 57 58struct Mat2 { int rows; }; 59 60@implementation ImplNoInt // expected-warning {{cannot find interface declaration for 'ImplNoInt'}} 61 62- (void)typoCorrentInDoWhile { 63 Mat2 tlMat1; // expected-note {{'tlMat1' declared here}} 64 // Create many scopes to exhaust the cache. 65 do { 66 for (int index = 0; index < 2; index++) { 67 if (true) { 68 for (int specialTileType = 1; specialTileType < 5; specialTileType++) { 69 for (int i = 0; i < 10; i++) { 70 for (double scale = 0.95; scale <= 1.055; scale += 0.05) { 71 for (int j = 0; j < 10; j++) { 72 if (1 > 0.9) { 73 for (int sptile = 1; sptile < 5; sptile++) { 74 } 75 } 76 } 77 } 78 } 79 } 80 } 81 } 82 } while (tlMat.rows); // expected-error {{use of undeclared identifier 'tlMat'; did you mean 'tlMat1'}} 83} 84 85@end 86