forked from OSchip/llvm-project
Make sure Sema::ActOnClassMessage() correctly diagnoses "super".
llvm-svn: 48924
This commit is contained in:
parent
b8654202dd
commit
0de4199ca0
|
@ -477,6 +477,8 @@ DIAG(error_missing_method_context, ERROR,
|
|||
"missing context for method declaration")
|
||||
DIAG(error_bad_receiver_type, ERROR,
|
||||
"bad receiver type '%0'")
|
||||
DIAG(error_no_super_class, ERROR,
|
||||
"no super class declared in @interface for '%0'")
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Semantic Analysis
|
||||
|
|
|
@ -146,7 +146,10 @@ Sema::ExprResult Sema::ActOnClassMessage(
|
|||
ObjCInterfaceDecl* ClassDecl = 0;
|
||||
if (!strcmp(receiverName->getName(), "super") && CurMethodDecl) {
|
||||
ClassDecl = CurMethodDecl->getClassInterface()->getSuperClass();
|
||||
if (ClassDecl && CurMethodDecl->isInstance()) {
|
||||
if (!ClassDecl)
|
||||
return Diag(lbrac, diag::error_no_super_class,
|
||||
CurMethodDecl->getClassInterface()->getName());
|
||||
if (CurMethodDecl->isInstance()) {
|
||||
// Synthesize a cast to the super class. This hack allows us to loosely
|
||||
// represent super without creating a special expression node.
|
||||
IdentifierInfo &II = Context.Idents.get("self");
|
||||
|
|
|
@ -18,3 +18,9 @@
|
|||
|
||||
@interface INTF1 // expected-error {{duplicate interface declaration for class 'INTF1'}}
|
||||
@end
|
||||
|
||||
@implementation SUPER
|
||||
- (void)dealloc {
|
||||
[super dealloc]; // expected-error {{no super class declared in @interface for 'SUPER'}}
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue