diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -1419,8 +1419,22 @@ const llvm::MapVector & getMismatchingDeleteExpressions() const; - typedef std::pair GlobalMethods; - typedef llvm::DenseMap GlobalMethodPool; + class GlobalMethodPool { + public: + using Lists = std::pair; + using iterator = llvm::DenseMap::iterator; + iterator begin() { return Methods.begin(); } + iterator end() { return Methods.end(); } + iterator find(Selector Sel) { return Methods.find(Sel); } + std::pair insert(std::pair &&Val) { + return Methods.insert(Val); + } + int count(Selector Sel) const { return Methods.count(Sel); } + bool empty() const { return Methods.empty(); } + + private: + llvm::DenseMap Methods; + }; /// Method Pool - allows efficient lookup when typechecking messages to "id". /// We need to maintain a list, since selectors can have differing signatures diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -3427,8 +3427,10 @@ GlobalMethodPool::iterator Pos = MethodPool.find(Method->getSelector()); if (Pos == MethodPool.end()) - Pos = MethodPool.insert(std::make_pair(Method->getSelector(), - GlobalMethods())).first; + Pos = MethodPool + .insert(std::make_pair(Method->getSelector(), + GlobalMethodPool::Lists())) + .first; Method->setDefined(impl); @@ -3636,7 +3638,7 @@ if (Pos == MethodPool.end()) return nullptr; - GlobalMethods &Methods = Pos->second; + GlobalMethodPool::Lists &Methods = Pos->second; for (const ObjCMethodList *Method = &Methods.first; Method; Method = Method->getNext()) if (Method->getMethod() && diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -8208,8 +8208,9 @@ return; Sema &S = *getSema(); - Sema::GlobalMethodPool::iterator Pos - = S.MethodPool.insert(std::make_pair(Sel, Sema::GlobalMethods())).first; + Sema::GlobalMethodPool::iterator Pos = + S.MethodPool.insert(std::make_pair(Sel, Sema::GlobalMethodPool::Lists())) + .first; Pos->second.first.setBits(Visitor.getInstanceBits()); Pos->second.first.setHasMoreThanOneDecl(Visitor.instanceHasMoreThanOneDecl());