зеркало из https://github.com/microsoft/clang-1.git
Fix <rdar://problem/5979875> clang on xcode: error: use of undeclared identifier 'super'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51888 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
6195c373b8
Коммит
e3e9add4fd
|
@ -335,6 +335,28 @@ public:
|
|||
static ObjCMessageExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// ObjCSuperRefExpr - A reference to super.
|
||||
class ObjCSuperRefExpr : public Expr {
|
||||
SourceLocation Loc;
|
||||
public:
|
||||
ObjCSuperRefExpr(QualType t, SourceLocation l) :
|
||||
Expr(ObjCSuperRefExprClass, t), Loc(l) {}
|
||||
|
||||
virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == ObjCSuperRefExprClass;
|
||||
}
|
||||
static bool classof(const ObjCSuperRefExpr *) { return true; }
|
||||
|
||||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ObjCSuperRefExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
|
||||
#endif
|
||||
|
|
|
@ -101,12 +101,13 @@ STMT(73, ObjCSelectorExpr , Expr)
|
|||
STMT(74, ObjCProtocolExpr , Expr)
|
||||
STMT(75, ObjCIvarRefExpr , Expr)
|
||||
STMT(76, ObjCPropertyRefExpr , Expr)
|
||||
STMT(77, ObjCSuperRefExpr , Expr)
|
||||
|
||||
// Clang Extensions.
|
||||
STMT(77, OverloadExpr , Expr)
|
||||
STMT(78, ShuffleVectorExpr , Expr)
|
||||
STMT(78, OverloadExpr , Expr)
|
||||
STMT(79, ShuffleVectorExpr , Expr)
|
||||
|
||||
LAST_EXPR(78)
|
||||
LAST_EXPR(79)
|
||||
|
||||
#undef STMT
|
||||
#undef FIRST_STMT
|
||||
|
|
|
@ -1189,7 +1189,7 @@ Stmt::child_iterator ObjCIvarRefExpr::child_end() {
|
|||
return reinterpret_cast<Stmt**>(&Base)+1;
|
||||
}
|
||||
|
||||
// ObjCIvarRefExpr
|
||||
// ObjCPropertyRefExpr
|
||||
Stmt::child_iterator ObjCPropertyRefExpr::child_begin() {
|
||||
return reinterpret_cast<Stmt**>(&Base);
|
||||
}
|
||||
|
@ -1198,6 +1198,10 @@ Stmt::child_iterator ObjCPropertyRefExpr::child_end() {
|
|||
return reinterpret_cast<Stmt**>(&Base)+1;
|
||||
}
|
||||
|
||||
// ObjCSuperRefExpr
|
||||
Stmt::child_iterator ObjCSuperRefExpr::child_begin() { return child_iterator();}
|
||||
Stmt::child_iterator ObjCSuperRefExpr::child_end() { return child_iterator(); }
|
||||
|
||||
// PreDefinedExpr
|
||||
Stmt::child_iterator PreDefinedExpr::child_begin() { return child_iterator(); }
|
||||
Stmt::child_iterator PreDefinedExpr::child_end() { return child_iterator(); }
|
||||
|
|
|
@ -476,6 +476,10 @@ void StmtPrinter::VisitDeclRefExpr(DeclRefExpr *Node) {
|
|||
OS << Node->getDecl()->getName();
|
||||
}
|
||||
|
||||
void StmtPrinter::VisitObjCSuperRefExpr(ObjCSuperRefExpr *Node) {
|
||||
OS << "super";
|
||||
}
|
||||
|
||||
void StmtPrinter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node) {
|
||||
if (Node->getBase()) {
|
||||
PrintExpr(Node->getBase());
|
||||
|
|
|
@ -518,6 +518,17 @@ DeclRefExpr* DeclRefExpr::CreateImpl(Deserializer& D, ASTContext& C) {
|
|||
return new DeclRefExpr(decl,T,Loc);
|
||||
}
|
||||
|
||||
void ObjCSuperRefExpr::EmitImpl(Serializer& S) const {
|
||||
S.Emit(Loc);
|
||||
S.Emit(getType());
|
||||
}
|
||||
|
||||
ObjCSuperRefExpr* ObjCSuperRefExpr::CreateImpl(Deserializer& D, ASTContext& C) {
|
||||
SourceLocation Loc = SourceLocation::ReadVal(D);
|
||||
QualType T = QualType::ReadVal(D);
|
||||
return new ObjCSuperRefExpr(T, Loc);
|
||||
}
|
||||
|
||||
DeclStmt* DeclStmt::CreateImpl(Deserializer& D, ASTContext& C) {
|
||||
ScopedDecl* decl = cast<ScopedDecl>(D.ReadOwnedPtr<Decl>(C));
|
||||
SourceLocation StartLoc = SourceLocation::ReadVal(D);
|
||||
|
|
|
@ -99,6 +99,11 @@ Sema::ExprResult Sema::ActOnIdentifierExpr(Scope *S, SourceLocation Loc,
|
|||
static_cast<Expr*>(SelfExpr.Val), true, true);
|
||||
}
|
||||
}
|
||||
if (!strncmp(II.getName(), "super", 5)) {
|
||||
QualType T = Context.getPointerType(Context.getObjCInterfaceType(
|
||||
CurMethodDecl->getClassInterface()));
|
||||
return new ObjCSuperRefExpr(T, Loc);
|
||||
}
|
||||
}
|
||||
|
||||
if (D == 0) {
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
// RUN: clang -fsyntax-only -verify %s
|
||||
typedef signed char BOOL;
|
||||
typedef struct _NSZone NSZone;
|
||||
|
||||
@protocol NSObject
|
||||
- (BOOL)isEqual:(id)object;
|
||||
@end
|
||||
|
||||
@protocol NSCopying
|
||||
- (id)copyWithZone:(NSZone *)zone;
|
||||
@end
|
||||
|
||||
@interface NSObject <NSObject> {}
|
||||
@end
|
||||
|
||||
@class NSString, NSData, NSMutableData, NSMutableDictionary, NSMutableArray;
|
||||
|
||||
@interface SCMObject : NSObject <NSCopying> {}
|
||||
@property(assign) SCMObject *__attribute__((objc_gc(weak))) parent;
|
||||
@end
|
||||
|
||||
@interface SCMNode : SCMObject
|
||||
{
|
||||
NSString *_name;
|
||||
}
|
||||
@property(copy) NSString *name;
|
||||
@end
|
||||
|
||||
@implementation SCMNode
|
||||
@synthesize name = _name;
|
||||
- (void) setParent:(SCMNode*) inParent {
|
||||
super.parent = inParent;
|
||||
}
|
||||
@end
|
Загрузка…
Ссылка в новой задаче