Fix a bug where a local variable named 'self' is causing
implicit ivar accesses to go through the 'self' variable
rather than the real 'self' for the method. // rdar://9730771
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134992 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaObjC/self-declared-in-block.m b/test/SemaObjC/self-declared-in-block.m
index 4bd7202..2131095 100644
--- a/test/SemaObjC/self-declared-in-block.m
+++ b/test/SemaObjC/self-declared-in-block.m
@@ -7,11 +7,12 @@
@implementation Blocky {
int _a;
}
-- (void)doAThing {
+- (int)doAThing {
^{
- char self; // expected-note {{declared here}}
- _a; // expected-error {{instance variable '_a' cannot be accessed because 'self' has been redeclared}}
+ char self;
+ return _a;
}();
+ return _a;
}
@end
@@ -37,14 +38,14 @@
(void)_anIvar;
}
{
- C* self; // expected-note {{declared here}}
- (void) _anIvar; // expected-error {{instance variable '_anIvar' cannot be accessed because 'self' has been redeclared}}
+ C* self;
+ (void) _anIvar;
}
}
- (void)doAThing {
^{
- id self; // expected-note {{declared here}}
- (void)_anIvar; // expected-error {{instance variable '_anIvar' cannot be accessed because 'self' has been redeclared}}
+ id self;
+ (void)_anIvar;
}();
}
@end