Skip to content

SmallVector::grow/swap should be shared for POD T's #4130

@lattner

Description

@lattner
Bugzilla Link 3758
Resolution FIXED
Resolved on Dec 16, 2009 02:44
Version 1.0
OS All

Extended Description

Looking at the exported symbol map of a couple of tools, I see a ton of things like this:

   llvm::SmallVectorImpl<clang::ProgramPoint>::grow(unsigned long)
   llvm::SmallVectorImpl<clang::QualType>::grow(unsigned long)
   llvm::SmallVectorImpl<clang::Selector>::grow(unsigned long)
   llvm::SmallVectorImpl<clang::SourceLocation>::grow(unsigned long)
   llvm::SmallVectorImpl<clang::Stmt*>::grow(unsigned long)
   llvm::SmallVectorImpl<clang::StringLiteral*>::grow(unsigned long)
   llvm::SmallVectorImpl<clang::SwitchStmt*>::grow(unsigned long)
   llvm::SmallVectorImpl<clang::Token>::grow(unsigned long)
   llvm::SmallVectorImpl<clang::Token>::operator=(llvm::SmallVectorImpl<clang::Token> const&)

These are all POD types, and there is no reason for them to all get their own copy of these (somewhat large) methods. We only need to instantiate grow/swap etc when T requires copy ctors etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions