summaryrefslogtreecommitdiffstats
path: root/test/SemaObjCXX
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2017-02-03 14:22:33 +0000
committerAlex Lorenz <arphaman@gmail.com>2017-02-03 14:22:33 +0000
commit7fa24c03e4984bff3c27830365cefba55c4260ea (patch)
tree6c286bb13e5fcebe4ccce9f0a260250babcd3443 /test/SemaObjCXX
parent0b6e3eba6801a3995dd16fc50952fbff3537537e (diff)
[Sema][ObjC++] Typo correction should handle ivars and properties
After r260016 and r260017 disabled typo correction for ivars and properties clang didn't report errors about unresolved identifier in the base of ivar and property ref expressions. This meant that clang invoked CodeGen on invalid AST which then caused a crash. This commit re-enables typo correction for ivars and properites, and fixes the PR25113 & PR26486 (that were originally fixed in r260017 and r260016) in a different manner by transforming the Objective-C ivar reference expression with 'IsFreeIvar' preserved. rdar://30310772 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@294008 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaObjCXX')
-rw-r--r--test/SemaObjCXX/typo-correction.mm15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/SemaObjCXX/typo-correction.mm b/test/SemaObjCXX/typo-correction.mm
index a34a7901e8..5e33bfb8cb 100644
--- a/test/SemaObjCXX/typo-correction.mm
+++ b/test/SemaObjCXX/typo-correction.mm
@@ -21,3 +21,18 @@ public:
self.m_prop2 = new ClassB(m_prop1); // expected-error {{use of undeclared identifier 'm_prop1'; did you mean '_m_prop1'?}}
}
@end
+
+// rdar://30310772
+
+@interface InvalidNameInIvarAndPropertyBase
+{
+@public
+ float _a;
+}
+@property float _b;
+@end
+
+void invalidNameInIvarAndPropertyBase() {
+ float a = ((InvalidNameInIvarAndPropertyBase*)node)->_a; // expected-error {{use of undeclared identifier 'node'}}
+ float b = ((InvalidNameInIvarAndPropertyBase*)node)._b; // expected-error {{use of undeclared identifier 'node'}}
+}