From 30844fc708fff3a35f33a4e2c3ba5257d8a0cdc4 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 19 May 2012 10:43:54 +0000 Subject: [PATCH] Simplify code, add an assertion. llvm-svn: 157111 --- clang/include/clang/AST/ASTContext.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h index d760e6d..49f76fe 100644 --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -1721,15 +1721,12 @@ public: /// interface, or null if non exists. const ObjCMethodDecl *getObjCMethodRedeclaration( const ObjCMethodDecl *MD) const { - llvm::DenseMap::const_iterator - I = ObjCMethodRedecls.find(MD); - if (I == ObjCMethodRedecls.end()) - return 0; - return I->second; + return ObjCMethodRedecls.lookup(MD); } void setObjCMethodRedeclaration(const ObjCMethodDecl *MD, const ObjCMethodDecl *Redecl) { + assert(!getObjCMethodRedeclaration(MD) && "MD already has a redeclaration"); ObjCMethodRedecls[MD] = Redecl; } -- 2.7.4