rmaz updated this revision to Diff 373072. rmaz added a comment. Update with single DenseSet per GlobalMethodPool
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D109632/new/ https://reviews.llvm.org/D109632 Files: clang/include/clang/Sema/Sema.h clang/lib/Sema/SemaDeclObjC.cpp Index: clang/lib/Sema/SemaDeclObjC.cpp =================================================================== --- clang/lib/Sema/SemaDeclObjC.cpp +++ clang/lib/Sema/SemaDeclObjC.cpp @@ -3302,6 +3302,10 @@ void Sema::addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method) { + // Do not insert duplicate methods into the method pool. + if (!MethodPool.addMethod(Method)) + return; + // Record at the head of the list whether there were 0, 1, or >= 2 methods // inside categories. if (ObjCCategoryDecl *CD = Index: clang/include/clang/Sema/Sema.h =================================================================== --- clang/include/clang/Sema/Sema.h +++ clang/include/clang/Sema/Sema.h @@ -1431,9 +1431,13 @@ } int count(Selector Sel) const { return Methods.count(Sel); } bool empty() const { return Methods.empty(); } + bool addMethod(ObjCMethodDecl *Method) { + return AddedMethods.insert(Method).second; + } private: llvm::DenseMap<Selector, Lists> Methods; + llvm::DenseSet<ObjCMethodDecl *> AddedMethods; }; /// Method Pool - allows efficient lookup when typechecking messages to "id".
Index: clang/lib/Sema/SemaDeclObjC.cpp =================================================================== --- clang/lib/Sema/SemaDeclObjC.cpp +++ clang/lib/Sema/SemaDeclObjC.cpp @@ -3302,6 +3302,10 @@ void Sema::addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method) { + // Do not insert duplicate methods into the method pool. + if (!MethodPool.addMethod(Method)) + return; + // Record at the head of the list whether there were 0, 1, or >= 2 methods // inside categories. if (ObjCCategoryDecl *CD = Index: clang/include/clang/Sema/Sema.h =================================================================== --- clang/include/clang/Sema/Sema.h +++ clang/include/clang/Sema/Sema.h @@ -1431,9 +1431,13 @@ } int count(Selector Sel) const { return Methods.count(Sel); } bool empty() const { return Methods.empty(); } + bool addMethod(ObjCMethodDecl *Method) { + return AddedMethods.insert(Method).second; + } private: llvm::DenseMap<Selector, Lists> Methods; + llvm::DenseSet<ObjCMethodDecl *> AddedMethods; }; /// Method Pool - allows efficient lookup when typechecking messages to "id".
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits