From d8a47c42cd016999d154b0a9a8bbc167ec25355d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 31 Mar 2009 08:36:08 +0000 Subject: [PATCH] simplify some casting llvm-svn: 68098 --- clang/lib/AST/DeclObjC.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index 855764fdbd31..cd1b979dcb0c 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -338,7 +338,7 @@ ObjCInterfaceDecl(DeclContext *DC, SourceLocation atLoc, IdentifierInfo *Id, } void ObjCInterfaceDecl::Destroy(ASTContext &C) { - for (ivar_iterator I=ivar_begin(), E=ivar_end(); I!=E; ++I) + for (ivar_iterator I = ivar_begin(), E = ivar_end(); I != E; ++I) if (*I) (*I)->Destroy(C); IVars.Destroy(C); @@ -371,13 +371,10 @@ FieldDecl *ObjCInterfaceDecl::lookupFieldDeclForIvar(ASTContext &Context, const ObjCIvarDecl *IVar) { const RecordDecl *RecordForDecl = Context.addRecordToClass(this); assert(RecordForDecl && "lookupFieldDeclForIvar no storage for class"); - DeclarationName Member = IVar->getDeclName(); - DeclContext::lookup_result Lookup = - (const_cast< RecordDecl *>(RecordForDecl))->lookup(Member); + DeclContext::lookup_const_result Lookup = + RecordForDecl->lookup(IVar->getDeclName()); assert((Lookup.first != Lookup.second) && "field decl not found"); - FieldDecl *MemberDecl = dyn_cast(*Lookup.first); - assert(MemberDecl && "field decl not found"); - return MemberDecl; + return cast(*Lookup.first); } //===----------------------------------------------------------------------===//