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 | 720130c0cff7c065175bd6854409913f2bebfd3e (patch) | |
| tree | fc8a3237990b44f96266a1a12d35423799bc7ad3 /clang/lib/AST | |
| parent | e1931fa6763e5f479fba691c9691de0640d20412 (diff) | |
| download | bcm5719-llvm-720130c0cff7c065175bd6854409913f2bebfd3e.tar.gz bcm5719-llvm-720130c0cff7c065175bd6854409913f2bebfd3e.zip | |
Turn CXXMethodVector into a generic class template.
llvm-svn: 102208
Diffstat (limited to 'clang/lib/AST')
| -rw-r--r-- | clang/lib/AST/ASTContext.cpp | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 27373478573..41ba4c2d71f 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/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 |

