Eliminate the static map of overridden C++ methods, which was going to
come back to bite us at some point. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97607 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp
index aa4b2dd..9b693af 100644
--- a/lib/AST/DeclCXX.cpp
+++ b/lib/AST/DeclCXX.cpp
@@ -611,51 +611,20 @@
   return true;
 }
 
-typedef llvm::DenseMap<const CXXMethodDecl*,
-                       std::vector<const CXXMethodDecl *> *>
-                       OverriddenMethodsMapTy;
-
-// FIXME: We hate static data.  This doesn't survive PCH saving/loading, and
-// the vtable building code uses it at CG time.
-static OverriddenMethodsMapTy *OverriddenMethods = 0;
-
 void CXXMethodDecl::addOverriddenMethod(const CXXMethodDecl *MD) {
   assert(MD->isCanonicalDecl() && "Method is not canonical!");
   assert(!MD->getParent()->isDependentContext() &&
          "Can't add an overridden method to a class template!");
 
-  // FIXME: The CXXMethodDecl dtor needs to remove and free the entry.
-
-  if (!OverriddenMethods)
-    OverriddenMethods = new OverriddenMethodsMapTy();
-
-  std::vector<const CXXMethodDecl *> *&Methods = (*OverriddenMethods)[this];
-  if (!Methods)
-    Methods = new std::vector<const CXXMethodDecl *>;
-
-  Methods->push_back(MD);
+  getASTContext().addOverriddenMethod(this, MD);
 }
 
 CXXMethodDecl::method_iterator CXXMethodDecl::begin_overridden_methods() const {
-  if (!OverriddenMethods)
-    return 0;
-
-  OverriddenMethodsMapTy::iterator it = OverriddenMethods->find(this);
-  if (it == OverriddenMethods->end() || it->second->empty())
-    return 0;
-
-  return &(*it->second)[0];
+  return getASTContext().overridden_methods_begin(this);
 }
 
 CXXMethodDecl::method_iterator CXXMethodDecl::end_overridden_methods() const {
-  if (!OverriddenMethods)
-    return 0;
-
-  OverriddenMethodsMapTy::iterator it = OverriddenMethods->find(this);
-  if (it == OverriddenMethods->end() || it->second->empty())
-    return 0;
-
-  return &(*it->second)[0] + it->second->size();
+  return getASTContext().overridden_methods_end(this);
 }
 
 QualType CXXMethodDecl::getThisType(ASTContext &C) const {