From 0a4e1f586c0e154e29dabff85a71893b0bba64f2 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Mon, 8 Jul 2013 04:44:01 +0000 Subject: [PATCH] Introduce a typedef for the type of NewlyDeducedPacks to avoid repeating the small size of the inner SmallVector. llvm-svn: 185789 --- clang/lib/Sema/SemaTemplateDeduction.cpp | 39 ++++++++++++------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 0ec8b6dd60a5..29ee6dfa994d 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -581,14 +581,17 @@ static TemplateParameter makeTemplateParameter(Decl *D) { return TemplateParameter(cast(D)); } +typedef SmallVector, 2> + NewlyDeducedPacksType; + /// \brief Prepare to perform template argument deduction for all of the /// arguments in a set of argument packs. -static void PrepareArgumentPackDeduction(Sema &S, - SmallVectorImpl &Deduced, - ArrayRef PackIndices, - SmallVectorImpl &SavedPacks, - SmallVectorImpl< - SmallVector > &NewlyDeducedPacks) { +static void +PrepareArgumentPackDeduction(Sema &S, + SmallVectorImpl &Deduced, + ArrayRef PackIndices, + SmallVectorImpl &SavedPacks, + NewlyDeducedPacksType &NewlyDeducedPacks) { // Save the deduced template arguments for each parameter pack expanded // by this pack expansion, then clear out the deduction. for (unsigned I = 0, N = PackIndices.size(); I != N; ++I) { @@ -620,14 +623,13 @@ static void PrepareArgumentPackDeduction(Sema &S, /// deductions. static Sema::TemplateDeductionResult FinishArgumentPackDeduction(Sema &S, - TemplateParameterList *TemplateParams, - bool HasAnyArguments, - SmallVectorImpl &Deduced, - ArrayRef PackIndices, - SmallVectorImpl &SavedPacks, - SmallVectorImpl< - SmallVector > &NewlyDeducedPacks, - TemplateDeductionInfo &Info) { + TemplateParameterList *TemplateParams, + bool HasAnyArguments, + SmallVectorImpl &Deduced, + ArrayRef PackIndices, + SmallVectorImpl &SavedPacks, + NewlyDeducedPacksType &NewlyDeducedPacks, + TemplateDeductionInfo &Info) { // Build argument packs for each of the parameter packs expanded by this // pack expansion. for (unsigned I = 0, N = PackIndices.size(); I != N; ++I) { @@ -793,8 +795,7 @@ DeduceTemplateArguments(Sema &S, // Keep track of the deduced template arguments for each parameter pack // expanded by this pack expansion (the outer index) and for each // template argument (the inner SmallVectors). - SmallVector, 2> - NewlyDeducedPacks(PackIndices.size()); + NewlyDeducedPacksType NewlyDeducedPacks(PackIndices.size()); SmallVector SavedPacks(PackIndices.size()); PrepareArgumentPackDeduction(S, Deduced, PackIndices, SavedPacks, @@ -1871,8 +1872,7 @@ DeduceTemplateArguments(Sema &S, // by this pack expansion, then clear out the deduction. SmallVector SavedPacks(PackIndices.size()); - SmallVector, 2> - NewlyDeducedPacks(PackIndices.size()); + NewlyDeducedPacksType NewlyDeducedPacks(PackIndices.size()); PrepareArgumentPackDeduction(S, Deduced, PackIndices, SavedPacks, NewlyDeducedPacks); @@ -3255,8 +3255,7 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate, // Keep track of the deduced template arguments for each parameter pack // expanded by this pack expansion (the outer index) and for each // template argument (the inner SmallVectors). - SmallVector, 2> - NewlyDeducedPacks(PackIndices.size()); + NewlyDeducedPacksType NewlyDeducedPacks(PackIndices.size()); SmallVector SavedPacks(PackIndices.size()); PrepareArgumentPackDeduction(*this, Deduced, PackIndices, SavedPacks,