From 0ca20ac8cea99c43d89510f29cf3dc876f9c9111 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 29 May 2009 18:27:38 +0000 Subject: [PATCH] Reduce the amount of stack space we use in SmallVectors during template instantiation. This helps reduce our stack footprint when performing deep template instantiations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72582 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaTemplateInstantiate.cpp | 8 ++++---- lib/Sema/SemaTemplateInstantiateDecl.cpp | 12 ++++++------ lib/Sema/SemaTemplateInstantiateExpr.cpp | 4 ++-- lib/Sema/SemaTemplateInstantiateStmt.cpp | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 1546e39ee2..42f36d1e03 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -378,7 +378,7 @@ InstantiateFunctionProtoType(const FunctionProtoType *T, if (ResultType.isNull()) return ResultType; - llvm::SmallVector ParamTypes; + llvm::SmallVector ParamTypes; for (FunctionProtoType::arg_type_iterator Param = T->arg_type_begin(), ParamEnd = T->arg_type_end(); Param != ParamEnd; ++Param) { @@ -497,7 +497,7 @@ TemplateTypeInstantiator:: InstantiateTemplateSpecializationType( const TemplateSpecializationType *T, unsigned Quals) const { - llvm::SmallVector InstantiatedTemplateArgs; + llvm::SmallVector InstantiatedTemplateArgs; InstantiatedTemplateArgs.reserve(T->getNumArgs()); for (TemplateSpecializationType::iterator Arg = T->begin(), ArgEnd = T->end(); Arg != ArgEnd; ++Arg) { @@ -669,7 +669,7 @@ Sema::InstantiateBaseSpecifiers(CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, const TemplateArgumentList &TemplateArgs) { bool Invalid = false; - llvm::SmallVector InstantiatedBases; + llvm::SmallVector InstantiatedBases; for (ClassTemplateSpecializationDecl::base_class_iterator Base = Pattern->bases_begin(), BaseEnd = Pattern->bases_end(); Base != BaseEnd; ++Base) { @@ -767,7 +767,7 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, if (InstantiateBaseSpecifiers(Instantiation, Pattern, TemplateArgs)) Invalid = true; - llvm::SmallVector Fields; + llvm::SmallVector Fields; for (RecordDecl::decl_iterator Member = Pattern->decls_begin(Context), MemberEnd = Pattern->decls_end(Context); Member != MemberEnd; ++Member) { diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index ef351f0954..6d7dc2e6d5 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -214,7 +214,7 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) { Owner->addDecl(SemaRef.Context, Enum); Enum->startDefinition(); - llvm::SmallVector Enumerators; + llvm::SmallVector Enumerators; EnumConstantDecl *LastEnumConst = 0; for (EnumDecl::enumerator_iterator EC = D->enumerator_begin(SemaRef.Context), @@ -288,7 +288,7 @@ Decl *TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D) { Sema::LocalInstantiationScope Scope(SemaRef); - llvm::SmallVector Params; + llvm::SmallVector Params; QualType T = InstantiateFunctionType(D, Params); if (T.isNull()) return 0; @@ -331,7 +331,7 @@ Decl *TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D) { Decl *TemplateDeclInstantiator::VisitCXXConstructorDecl(CXXConstructorDecl *D) { Sema::LocalInstantiationScope Scope(SemaRef); - llvm::SmallVector Params; + llvm::SmallVector Params; QualType T = InstantiateFunctionType(D, Params); if (T.isNull()) return 0; @@ -378,7 +378,7 @@ Decl *TemplateDeclInstantiator::VisitCXXConstructorDecl(CXXConstructorDecl *D) { Decl *TemplateDeclInstantiator::VisitCXXDestructorDecl(CXXDestructorDecl *D) { Sema::LocalInstantiationScope Scope(SemaRef); - llvm::SmallVector Params; + llvm::SmallVector Params; QualType T = InstantiateFunctionType(D, Params); if (T.isNull()) return 0; @@ -409,7 +409,7 @@ Decl *TemplateDeclInstantiator::VisitCXXDestructorDecl(CXXDestructorDecl *D) { Decl *TemplateDeclInstantiator::VisitCXXConversionDecl(CXXConversionDecl *D) { Sema::LocalInstantiationScope Scope(SemaRef); - llvm::SmallVector Params; + llvm::SmallVector Params; QualType T = InstantiateFunctionType(D, Params); if (T.isNull()) return 0; @@ -505,7 +505,7 @@ TemplateDeclInstantiator::InstantiateFunctionType(FunctionDecl *D, // Instantiate the function parameters TemplateDeclInstantiator ParamInstantiator(SemaRef, 0, TemplateArgs); - llvm::SmallVector ParamTys; + llvm::SmallVector ParamTys; for (FunctionDecl::param_iterator P = D->param_begin(), PEnd = D->param_end(); P != PEnd; ++P) { diff --git a/lib/Sema/SemaTemplateInstantiateExpr.cpp b/lib/Sema/SemaTemplateInstantiateExpr.cpp index 31bb91def2..c312bb8542 100644 --- a/lib/Sema/SemaTemplateInstantiateExpr.cpp +++ b/lib/Sema/SemaTemplateInstantiateExpr.cpp @@ -575,7 +575,7 @@ Sema::OwningExprResult TemplateExprInstantiator::VisitVAArgExpr(VAArgExpr *E) { Sema::OwningExprResult TemplateExprInstantiator::VisitInitListExpr(InitListExpr *E) { - ExprVector Inits(SemaRef); + ASTOwningVector<&ActionBase::DeleteExpr, 4> Inits(SemaRef); for (unsigned I = 0, N = E->getNumInits(); I != N; ++I) { OwningExprResult Init = Visit(E->getInit(I)); if (Init.isInvalid()) @@ -597,7 +597,7 @@ TemplateExprInstantiator::VisitDesignatedInitExpr(DesignatedInitExpr *E) { return SemaRef.ExprError(); // Instantiate the designators. - ExprVector ArrayExprs(SemaRef); // Expresses used in array designators + ASTOwningVector<&ActionBase::DeleteExpr, 4> ArrayExprs(SemaRef); for (DesignatedInitExpr::designators_iterator D = E->designators_begin(), DEnd = E->designators_end(); D != DEnd; ++D) { diff --git a/lib/Sema/SemaTemplateInstantiateStmt.cpp b/lib/Sema/SemaTemplateInstantiateStmt.cpp index a62607d116..91807c3e6a 100644 --- a/lib/Sema/SemaTemplateInstantiateStmt.cpp +++ b/lib/Sema/SemaTemplateInstantiateStmt.cpp @@ -60,7 +60,7 @@ namespace { // Common/C statements //===----------------------------------------------------------------------===/ Sema::OwningStmtResult TemplateStmtInstantiator::VisitDeclStmt(DeclStmt *S) { - llvm::SmallVector Decls; + llvm::SmallVector Decls; for (DeclStmt::decl_iterator D = S->decl_begin(), DEnd = S->decl_end(); D != DEnd; ++D) { Decl *Instantiated = SemaRef.InstantiateDecl(*D, SemaRef.CurContext, -- 2.40.0