This also fixes cases where super is used in a block in a
method which isn't valid.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101021
91177308-0d34-0410-b5e6-
96231b3b80d8
// Support 'Class.property' and 'super.property' notation.
if (getLang().ObjC1 && Tok.is(tok::period) &&
- (Actions.getTypeName(II, ILoc, CurScope) || II.isStr("super"))) {
+ (Actions.getTypeName(II, ILoc, CurScope) ||
+ // Allow the base to be 'super' if in an objc-method.
+ (II.isStr("super") && CurScope->isInObjcMethodScope()))) {
SourceLocation DotLoc = ConsumeToken();
if (Tok.isNot(tok::identifier)) {
[FooTD cMethod];
[super cMethod];
}
+
+struct SomeStruct {
+ int X;
+};
+
+int test2() {
+ struct SomeStruct super = { 0 };
+ return super.X;
+}