castToDeclContext/castFromDeclContext are only required to be included in the class of decls that directly derive from DeclContext.

Their subclasses don't need them.

llvm-svn: 64632
This commit is contained in:
Argyrios Kyrtzidis 2009-02-16 14:31:00 +00:00
parent 9b7bd9bfc6
commit 73b85e30ed
3 changed files with 6 additions and 60 deletions

View File

@ -954,12 +954,6 @@ public:
static bool classof(const Decl *D) { return D->getKind() == Enum; }
static bool classof(const EnumDecl *D) { return true; }
static DeclContext *castToDeclContext(const EnumDecl *D) {
return static_cast<DeclContext *>(const_cast<EnumDecl*>(D));
}
static EnumDecl *castFromDeclContext(const DeclContext *DC) {
return static_cast<EnumDecl *>(const_cast<DeclContext*>(DC));
}
protected:
/// EmitImpl - Serialize this EnumDecl. Called by Decl::Emit.
@ -1054,12 +1048,6 @@ public:
return D->getKind() >= RecordFirst && D->getKind() <= RecordLast;
}
static bool classof(const RecordDecl *D) { return true; }
static DeclContext *castToDeclContext(const RecordDecl *D) {
return static_cast<DeclContext *>(const_cast<RecordDecl*>(D));
}
static RecordDecl *castFromDeclContext(const DeclContext *DC) {
return static_cast<RecordDecl *>(const_cast<DeclContext*>(DC));
}
protected:
/// EmitImpl - Serialize this RecordDecl. Called by Decl::Emit.
virtual void EmitImpl(llvm::Serializer& S) const;

View File

@ -357,12 +357,6 @@ public:
static bool classof(const Decl *D) { return D->getKind() == CXXRecord; }
static bool classof(const CXXRecordDecl *D) { return true; }
static DeclContext *castToDeclContext(const CXXRecordDecl *D) {
return static_cast<DeclContext *>(const_cast<CXXRecordDecl*>(D));
}
static CXXRecordDecl *castFromDeclContext(const DeclContext *DC) {
return static_cast<CXXRecordDecl *>(const_cast<DeclContext*>(DC));
}
protected:
/// EmitImpl - Serialize this CXXRecordDecl. Called by Decl::Emit.
@ -425,12 +419,6 @@ public:
return D->getKind() >= CXXMethod && D->getKind() <= CXXConversion;
}
static bool classof(const CXXMethodDecl *D) { return true; }
static DeclContext *castToDeclContext(const CXXMethodDecl *D) {
return static_cast<DeclContext *>(const_cast<CXXMethodDecl*>(D));
}
static CXXMethodDecl *castFromDeclContext(const DeclContext *DC) {
return static_cast<CXXMethodDecl *>(const_cast<DeclContext*>(DC));
}
protected:
/// EmitImpl - Serialize this CXXMethodDecl. Called by Decl::Emit.
@ -638,12 +626,6 @@ public:
return D->getKind() == CXXConstructor;
}
static bool classof(const CXXConstructorDecl *D) { return true; }
static DeclContext *castToDeclContext(const CXXConstructorDecl *D) {
return static_cast<DeclContext *>(const_cast<CXXConstructorDecl*>(D));
}
static CXXConstructorDecl *castFromDeclContext(const DeclContext *DC) {
return static_cast<CXXConstructorDecl *>(const_cast<DeclContext*>(DC));
}
/// EmitImpl - Serialize this CXXConstructorDecl. Called by Decl::Emit.
// FIXME: Implement this.
//virtual void EmitImpl(llvm::Serializer& S) const;
@ -708,12 +690,6 @@ public:
return D->getKind() == CXXDestructor;
}
static bool classof(const CXXDestructorDecl *D) { return true; }
static DeclContext *castToDeclContext(const CXXDestructorDecl *D) {
return static_cast<DeclContext *>(const_cast<CXXDestructorDecl*>(D));
}
static CXXDestructorDecl *castFromDeclContext(const DeclContext *DC) {
return static_cast<CXXDestructorDecl *>(const_cast<DeclContext*>(DC));
}
/// EmitImpl - Serialize this CXXDestructorDecl. Called by Decl::Emit.
// FIXME: Implement this.
//virtual void EmitImpl(llvm::Serializer& S) const;
@ -766,12 +742,6 @@ public:
return D->getKind() == CXXConversion;
}
static bool classof(const CXXConversionDecl *D) { return true; }
static DeclContext *castToDeclContext(const CXXConversionDecl *D) {
return static_cast<DeclContext *>(const_cast<CXXConversionDecl*>(D));
}
static CXXConversionDecl *castFromDeclContext(const DeclContext *DC) {
return static_cast<CXXConversionDecl *>(const_cast<DeclContext*>(DC));
}
/// EmitImpl - Serialize this CXXConversionDecl. Called by Decl::Emit.
// FIXME: Implement this.
//virtual void EmitImpl(llvm::Serializer& S) const;
@ -878,6 +848,12 @@ public:
return D->getKind() == LinkageSpec;
}
static bool classof(const LinkageSpecDecl *D) { return true; }
static DeclContext *castToDeclContext(const LinkageSpecDecl *D) {
return static_cast<DeclContext *>(const_cast<LinkageSpecDecl*>(D));
}
static LinkageSpecDecl *castFromDeclContext(const DeclContext *DC) {
return static_cast<LinkageSpecDecl *>(const_cast<DeclContext*>(DC));
}
protected:
void EmitInRec(llvm::Serializer& S) const;

View File

@ -478,12 +478,6 @@ public:
static bool classof(const Decl *D) { return D->getKind() == ObjCInterface; }
static bool classof(const ObjCInterfaceDecl *D) { return true; }
static DeclContext *castToDeclContext(const ObjCInterfaceDecl *D) {
return static_cast<DeclContext *>(const_cast<ObjCInterfaceDecl*>(D));
}
static ObjCInterfaceDecl *castFromDeclContext(const DeclContext *DC) {
return static_cast<ObjCInterfaceDecl *>(const_cast<DeclContext*>(DC));
}
};
/// ObjCIvarDecl - Represents an ObjC instance variable. In general, ObjC
@ -633,12 +627,6 @@ public:
static bool classof(const Decl *D) { return D->getKind() == ObjCProtocol; }
static bool classof(const ObjCProtocolDecl *D) { return true; }
static DeclContext *castToDeclContext(const ObjCProtocolDecl *D) {
return static_cast<DeclContext *>(const_cast<ObjCProtocolDecl*>(D));
}
static ObjCProtocolDecl *castFromDeclContext(const DeclContext *DC) {
return static_cast<ObjCProtocolDecl *>(const_cast<DeclContext*>(DC));
}
};
/// ObjCClassDecl - Specifies a list of forward class declarations. For example:
@ -816,12 +804,6 @@ public:
static bool classof(const Decl *D) { return D->getKind() == ObjCCategory; }
static bool classof(const ObjCCategoryDecl *D) { return true; }
static DeclContext *castToDeclContext(const ObjCCategoryDecl *D) {
return static_cast<DeclContext *>(const_cast<ObjCCategoryDecl*>(D));
}
static ObjCCategoryDecl *castFromDeclContext(const DeclContext *DC) {
return static_cast<ObjCCategoryDecl *>(const_cast<DeclContext*>(DC));
}
};
/// ObjCCategoryImplDecl - An object of this class encapsulates a category