Using dyn_cast_or_null here is redundant, use dyn_cast instead.

llvm-svn: 57642
This commit is contained in:
Argyrios Kyrtzidis 2008-10-16 16:50:47 +00:00
parent 0bd120e817
commit 89656d2298
1 changed files with 6 additions and 6 deletions

View File

@ -931,23 +931,23 @@ QualType ASTContext::getFunctionType(QualType ResultTy,const QualType *ArgArray,
/// getTypeDeclType - Return the unique reference to the type for the /// getTypeDeclType - Return the unique reference to the type for the
/// specified type declaration. /// specified type declaration.
QualType ASTContext::getTypeDeclType(TypeDecl *Decl, TypeDecl* PrevDecl) { QualType ASTContext::getTypeDeclType(TypeDecl *Decl, TypeDecl* PrevDecl) {
assert(Decl && "Passed null for Decl param");
if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0); if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0);
if (TypedefDecl *Typedef = dyn_cast_or_null<TypedefDecl>(Decl)) if (TypedefDecl *Typedef = dyn_cast<TypedefDecl>(Decl))
return getTypedefType(Typedef); return getTypedefType(Typedef);
else if (ObjCInterfaceDecl *ObjCInterface else if (ObjCInterfaceDecl *ObjCInterface = dyn_cast<ObjCInterfaceDecl>(Decl))
= dyn_cast_or_null<ObjCInterfaceDecl>(Decl))
return getObjCInterfaceType(ObjCInterface); return getObjCInterfaceType(ObjCInterface);
if (CXXRecordDecl *CXXRecord = dyn_cast_or_null<CXXRecordDecl>(Decl)) { if (CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(Decl)) {
Decl->TypeForDecl = PrevDecl ? PrevDecl->TypeForDecl Decl->TypeForDecl = PrevDecl ? PrevDecl->TypeForDecl
: new CXXRecordType(CXXRecord); : new CXXRecordType(CXXRecord);
} }
else if (RecordDecl *Record = dyn_cast_or_null<RecordDecl>(Decl)) { else if (RecordDecl *Record = dyn_cast<RecordDecl>(Decl)) {
Decl->TypeForDecl = PrevDecl ? PrevDecl->TypeForDecl Decl->TypeForDecl = PrevDecl ? PrevDecl->TypeForDecl
: new RecordType(Record); : new RecordType(Record);
} }
else if (EnumDecl *Enum = dyn_cast_or_null<EnumDecl>(Decl)) else if (EnumDecl *Enum = dyn_cast<EnumDecl>(Decl))
Decl->TypeForDecl = new EnumType(Enum); Decl->TypeForDecl = new EnumType(Enum);
else else
assert(false && "TypeDecl without a type?"); assert(false && "TypeDecl without a type?");