[cfe-commits] r68659 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExpr.cpp test/SemaObjC/call-super-2.m
Steve Naroff
snaroff at apple.com
Wed Apr 8 16:52:26 PDT 2009
Author: snaroff
Date: Wed Apr 8 18:52:26 2009
New Revision: 68659
URL: http://llvm.org/viewvc/llvm-project?rev=68659&view=rev
Log:
Fix <rdar://problem/6770998> make cast of super illegal (again:-)
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaObjC/call-super-2.m
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=68659&r1=68658&r2=68659&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Apr 8 18:52:26 2009
@@ -1024,8 +1024,8 @@
"@catch parameter is not an Objective-C class type">;
def err_illegal_qualifiers_on_catch_parm : Error<
"illegal qualifiers on @catch parameter">;
-def warn_super_cast_deprecated : Warning<
- "casting 'super' is deprecated (it isn't an expression)">;
+def err_illegal_super_cast : Error<
+ "cannot cast 'super' (it isn't an expression)">;
// C++ casts
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=68659&r1=68658&r2=68659&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Apr 8 18:52:26 2009
@@ -2510,7 +2510,7 @@
if (CheckVectorCast(TyR, castType, castExpr->getType()))
return true;
} else if (getLangOptions().ObjC1 && isa<ObjCSuperExpr>(castExpr)) {
- Diag(castExpr->getLocStart(), diag::warn_super_cast_deprecated) << TyR;
+ return Diag(castExpr->getLocStart(), diag::err_illegal_super_cast) << TyR;
}
return false;
}
Modified: cfe/trunk/test/SemaObjC/call-super-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/call-super-2.m?rev=68659&r1=68658&r2=68659&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/call-super-2.m (original)
+++ cfe/trunk/test/SemaObjC/call-super-2.m Wed Apr 8 18:52:26 2009
@@ -2,10 +2,7 @@
#include <stddef.h>
-typedef struct objc_class *Class;
-typedef struct objc_object {
- Class isa;
-} *id;
+typedef struct objc_object *id;
id objc_getClass(const char *s);
@interface Object
@@ -42,17 +39,17 @@
+ (int) class_func2
{
int i = [(id <Func>)self class_func0];
- i += [(id <Func>)super class_func0]; // expected-warning {{casting 'super' is deprecated (it isn't an expression)}}
+ i += [(id <Func>)super class_func0]; // expected-error {{cannot cast 'super' (it isn't an expression)}}
i += [(Class <Func>)self class_func0]; // expected-error {{protocol qualified 'Class' is unsupported}}
- return i + [(Class <Func>)super class_func0]; // expected-error {{protocol qualified 'Class' is unsupported}} // expected-warning {{casting 'super' is deprecated (it isn't an expression)}}
+ return i + [(Class <Func>)super class_func0]; // expected-error {{protocol qualified 'Class' is unsupported}} // expected-error {{cannot cast 'super' (it isn't an expression)}}
}
+ (int) class_func3
{
- return [(Object <Func> *)super class_func0]; // expected-warning {{casting 'super' is deprecated (it isn't an expression)}} // expected-warning {{method '-class_func0' not found (return type defaults to 'id')}} // expected-warning {{incompatible pointer to integer conversion returning 'id', expected 'int'}}
+ return [(Object <Func> *)super class_func0]; // expected-error {{cannot cast 'super' (it isn't an expression)}}
}
+ (int) class_func4
{
- return [(Derived <Func> *)super class_func0]; // expected-warning {{casting 'super' is deprecated (it isn't an expression)}} // expected-warning {{method '-class_func0' not found (return type defaults to 'id')}} // expected-warning {{incompatible pointer to integer conversion returning 'id', expected 'int'}}
+ return [(Derived <Func> *)super class_func0]; // expected-error {{cannot cast 'super' (it isn't an expression)}}
}
+ (int) class_func5
{
@@ -74,15 +71,15 @@
}
- (int) instance_func2
{
- return [(id <Func>)super instance_func0]; // expected-warning {{casting 'super' is deprecated (it isn't an expression)}}
+ return [(id <Func>)super instance_func0]; // expected-error {{cannot cast 'super' (it isn't an expression)}}
}
- (int) instance_func3
{
- return [(Object <Func> *)super instance_func0]; // expected-warning {{casting 'super' is deprecated (it isn't an expression)}}
+ return [(Object <Func> *)super instance_func0]; // expected-error {{cannot cast 'super' (it isn't an expression)}}
}
- (int) instance_func4
{
- return [(Derived <Func> *)super instance_func0]; // expected-warning {{casting 'super' is deprecated (it isn't an expression)}}
+ return [(Derived <Func> *)super instance_func0]; // expected-error {{cannot cast 'super' (it isn't an expression)}}
}
- (int) instance_func5
{
More information about the cfe-commits
mailing list