diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-02-22 18:29:39 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-02-22 18:29:39 +0000 |
commit | f512acee01617c9da8079ed88ded3bb9f2418349 (patch) | |
tree | c30895769887135415c9f804566de2d96806b38b /include/clang/AST/ASTContext.h | |
parent | 4c8cba87e49ec2fd39c1ff3b903924e791734a8a (diff) | |
download | clang-f512acee01617c9da8079ed88ded3bb9f2418349.tar.gz |
Replace some typically large vectors with SmallVector.
This may seem counter-intuitive but the POD-like optimization helps when the
vectors grow into multimegabyte buffers. SmallVector calls realloc which knows
how to twiddle virtual memory bits and avoids large copies.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175906 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/AST/ASTContext.h')
-rw-r--r-- | include/clang/AST/ASTContext.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index b483535205..7c02699ee4 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -75,7 +75,7 @@ namespace clang { class ASTContext : public RefCountedBase<ASTContext> { ASTContext &this_() { return *this; } - mutable std::vector<Type*> Types; + mutable SmallVector<Type *, 0> Types; mutable llvm::FoldingSet<ExtQuals> ExtQualNodes; mutable llvm::FoldingSet<ComplexType> ComplexTypes; mutable llvm::FoldingSet<PointerType> PointerTypes; @@ -748,7 +748,7 @@ public: ASTMutationListener *getASTMutationListener() const { return Listener; } void PrintStats() const; - const std::vector<Type*>& getTypes() const { return Types; } + const SmallVectorImpl<Type *>& getTypes() const { return Types; } /// \brief Retrieve the declaration for the 128-bit signed integer type. TypedefDecl *getInt128Decl() const; @@ -1908,8 +1908,8 @@ public: // Type Iterators. //===--------------------------------------------------------------------===// - typedef std::vector<Type*>::iterator type_iterator; - typedef std::vector<Type*>::const_iterator const_type_iterator; + typedef SmallVectorImpl<Type *>::iterator type_iterator; + typedef SmallVectorImpl<Type *>::const_iterator const_type_iterator; type_iterator types_begin() { return Types.begin(); } type_iterator types_end() { return Types.end(); } |