From: Benjamin Kramer Date: Sat, 19 May 2012 10:43:54 +0000 (+0000) Subject: Simplify code, add an assertion. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=93a8534090a6de23d655679205b974032d092a89;p=clang Simplify code, add an assertion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157111 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index d760e6dbbf..49f76fe180 100644 --- a/include/clang/AST/ASTContext.h +++ b/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; }