86 lines · plain
1// RUN: %clang_cc1 %s -verify -fsyntax-only -Wno-objc-root-class2 3class ClassA {};4 5class ClassB {6public:7 ClassB(ClassA* parent=0);8 ~ClassB();9};10 11@interface NSObject12@end13 14@interface InterfaceA : NSObject15@property(nonatomic, assign) ClassA *m_prop1; // expected-note {{here}}16@property(nonatomic, assign) ClassB *m_prop2;17@end18 19@implementation InterfaceA20- (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@end24 25@interface InvalidNameInIvarAndPropertyBase26{27@public28 float _a;29}30@property float _b;31@end32 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 candidates39// synthesized ivar and a class name, both at the same edit distance.40@class TypoCandidate;41 42@interface PropertyType : NSObject43@property int x;44@end45 46@interface InterfaceC : NSObject47@property(assign) PropertyType *typoCandidate; // expected-note {{'_typoCandidate' declared here}}48@end49 50@implementation InterfaceC51-(void)method {52 typoCandidate.x = 0; // expected-error {{use of undeclared identifier 'typoCandidate'; did you mean '_typoCandidate'?}}53}54@end55 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@end86