[cfe-commits] r68098 - /cfe/trunk/lib/AST/DeclObjC.cpp
Chris Lattner
sabre at nondot.org
Tue Mar 31 01:36:09 PDT 2009
Author: lattner
Date: Tue Mar 31 03:36:08 2009
New Revision: 68098
URL: http://llvm.org/viewvc/llvm-project?rev=68098&view=rev
Log:
simplify some casting
Modified:
cfe/trunk/lib/AST/DeclObjC.cpp
Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=68098&r1=68097&r2=68098&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Tue Mar 31 03:36:08 2009
@@ -338,7 +338,7 @@
}
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 @@
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<FieldDecl>(*Lookup.first);
- assert(MemberDecl && "field decl not found");
- return MemberDecl;
+ return cast<FieldDecl>(*Lookup.first);
}
//===----------------------------------------------------------------------===//
More information about the cfe-commits
mailing list