[cfe-commits] r101021 - in /cfe/trunk: lib/Parse/ParseExpr.cpp test/SemaObjC/super.m
Chris Lattner
sabre at nondot.org
Sun Apr 11 23:20:33 PDT 2010
Author: lattner
Date: Mon Apr 12 01:20:33 2010
New Revision: 101021
URL: http://llvm.org/viewvc/llvm-project?rev=101021&view=rev
Log:
fix a rejects-valid testcase involving super that I dreamt up.
This also fixes cases where super is used in a block in a
method which isn't valid.
Modified:
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/test/SemaObjC/super.m
Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=101021&r1=101020&r2=101021&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Mon Apr 12 01:20:33 2010
@@ -639,7 +639,9 @@
// 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)) {
Modified: cfe/trunk/test/SemaObjC/super.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/super.m?rev=101021&r1=101020&r2=101021&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/super.m (original)
+++ cfe/trunk/test/SemaObjC/super.m Mon Apr 12 01:20:33 2010
@@ -49,3 +49,12 @@
[FooTD cMethod];
[super cMethod];
}
+
+struct SomeStruct {
+ int X;
+};
+
+int test2() {
+ struct SomeStruct super = { 0 };
+ return super.X;
+}
More information about the cfe-commits
mailing list