aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-03-31 08:36:08 +0000
committerChris Lattner <sabre@nondot.org>2009-03-31 08:36:08 +0000
commitd13d30258647e20c55a3910e4969f4a47bb2802c (patch)
tree0c5acedcff3d46467892f8eb9b62ab26dbda38fd
parentcd0ee14a3b8ba7293670f760c982063f4615e105 (diff)
simplify some casting
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68098 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/DeclObjC.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 855764fdbd..cd1b979dcb 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/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<FieldDecl>(*Lookup.first);
- assert(MemberDecl && "field decl not found");
- return MemberDecl;
+ return cast<FieldDecl>(*Lookup.first);
}
//===----------------------------------------------------------------------===//