Author: akirtzidis
Date: Thu Oct 16 11:50:47 2008
New Revision: 57642

URL: http://llvm.org/viewvc/llvm-project?rev=57642&view=rev
Log:
Using dyn_cast_or_null here is redundant, use dyn_cast instead.

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=57642&r1=57641&r2=57642&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Thu Oct 16 11:50:47 2008
@@ -931,23 +931,23 @@
 /// getTypeDeclType - Return the unique reference to the type for the
 /// specified type declaration.
 QualType ASTContext::getTypeDeclType(TypeDecl *Decl, TypeDecl* PrevDecl) {
+  assert(Decl && "Passed null for Decl param");
   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);
-  else if (ObjCInterfaceDecl *ObjCInterface 
-             = dyn_cast_or_null<ObjCInterfaceDecl>(Decl))
+  else if (ObjCInterfaceDecl *ObjCInterface = 
dyn_cast<ObjCInterfaceDecl>(Decl))
     return getObjCInterfaceType(ObjCInterface);
 
-  if (CXXRecordDecl *CXXRecord = dyn_cast_or_null<CXXRecordDecl>(Decl)) {
+  if (CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(Decl)) {
     Decl->TypeForDecl = PrevDecl ? PrevDecl->TypeForDecl
                                  : 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
                                  : 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);
   else
     assert(false && "TypeDecl without a type?");


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to