[cfe-commits] r157111 - /cfe/trunk/include/clang/AST/ASTContext.h

Benjamin Kramer benny.kra at googlemail.com
Sat May 19 03:43:54 PDT 2012


Author: d0k
Date: Sat May 19 05:43:54 2012
New Revision: 157111

URL: http://llvm.org/viewvc/llvm-project?rev=157111&view=rev
Log:
Simplify code, add an assertion.

Modified:
    cfe/trunk/include/clang/AST/ASTContext.h

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=157111&r1=157110&r2=157111&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Sat May 19 05:43:54 2012
@@ -1721,15 +1721,12 @@
   /// interface, or null if non exists.
   const ObjCMethodDecl *getObjCMethodRedeclaration(
                                                const ObjCMethodDecl *MD) const {
-    llvm::DenseMap<const ObjCMethodDecl*, const ObjCMethodDecl*>::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;
   }
 





More information about the cfe-commits mailing list