diff options
author | Anders Carlsson <andersca@mac.com> | 2010-04-23 19:53:03 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-04-23 19:53:03 +0000 |
commit | 046861b912ed72bdc364d7905180ee63e5b08870 (patch) | |
tree | 5a2f8e8fd2cc31b8220aa681198347525f5d5607 /lib | |
parent | b76db237b8c2080137f9dc3362712432f3150ff1 (diff) |
Turn CXXMethodVector into a generic class template.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102208 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/ASTContext.cpp | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 2737347857..41ba4c2d71 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -326,55 +326,6 @@ void ASTContext::setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, InstantiatedFromUnnamedFieldDecl[Inst] = Tmpl; } -CXXMethodVector::iterator CXXMethodVector::begin() const { - if ((Storage & 0x01) == 0) - return reinterpret_cast<iterator>(&Storage); - - vector_type *Vec = reinterpret_cast<vector_type *>(Storage & ~0x01); - return &Vec->front(); -} - -CXXMethodVector::iterator CXXMethodVector::end() const { - if ((Storage & 0x01) == 0) { - if (Storage == 0) - return reinterpret_cast<iterator>(&Storage); - - return reinterpret_cast<iterator>(&Storage) + 1; - } - - vector_type *Vec = reinterpret_cast<vector_type *>(Storage & ~0x01); - return &Vec->front() + Vec->size(); -} - -void CXXMethodVector::push_back(const CXXMethodDecl *Method) { - if (Storage == 0) { - // 0 -> 1 element. - Storage = reinterpret_cast<uintptr_t>(Method); - return; - } - - vector_type *Vec; - if ((Storage & 0x01) == 0) { - // 1 -> 2 elements. Allocate a new vector and push the element into that - // vector. - Vec = new vector_type; - Vec->push_back(reinterpret_cast<const CXXMethodDecl *>(Storage)); - Storage = reinterpret_cast<uintptr_t>(Vec) | 0x01; - } else - Vec = reinterpret_cast<vector_type *>(Storage & ~0x01); - - // Add the new method to the vector. - Vec->push_back(Method); -} - -void CXXMethodVector::Destroy() { - if (Storage & 0x01) - delete reinterpret_cast<vector_type *>(Storage & ~0x01); - - Storage = 0; -} - - ASTContext::overridden_cxx_method_iterator ASTContext::overridden_methods_begin(const CXXMethodDecl *Method) const { llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::const_iterator Pos |