r256463 - ArrayRef-ize TemplateParameterList. NFC
David Majnemer via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 26 23:16:27 PST 2015
Author: majnemer
Date: Sun Dec 27 01:16:27 2015
New Revision: 256463
URL: http://llvm.org/viewvc/llvm-project?rev=256463&view=rev
Log:
ArrayRef-ize TemplateParameterList. NFC
Modified:
cfe/trunk/include/clang/AST/DeclTemplate.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/lib/AST/DeclTemplate.cpp
cfe/trunk/lib/Sema/SemaLambda.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=256463&r1=256462&r2=256463&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Sun Dec 27 01:16:27 2015
@@ -68,15 +68,13 @@ protected:
}
TemplateParameterList(SourceLocation TemplateLoc, SourceLocation LAngleLoc,
- NamedDecl **Params, unsigned NumParams,
- SourceLocation RAngleLoc);
+ ArrayRef<NamedDecl *> Params, SourceLocation RAngleLoc);
public:
static TemplateParameterList *Create(const ASTContext &C,
SourceLocation TemplateLoc,
SourceLocation LAngleLoc,
- NamedDecl **Params,
- unsigned NumParams,
+ ArrayRef<NamedDecl *> Params,
SourceLocation RAngleLoc);
/// \brief Iterates through the template parameters in this list.
@@ -155,9 +153,9 @@ template <size_t N> class FixedSizeTempl
public:
FixedSizeTemplateParameterListStorage(SourceLocation TemplateLoc,
SourceLocation LAngleLoc,
- NamedDecl **Params,
+ ArrayRef<NamedDecl *> Params,
SourceLocation RAngleLoc)
- : List(TemplateLoc, LAngleLoc, Params, N, RAngleLoc) {
+ : List(TemplateLoc, LAngleLoc, Params, RAngleLoc) {
// Because we're doing an evil layout hack above, have some
// asserts, just to double-check everything is laid out like
// expected.
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=256463&r1=256462&r2=256463&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Sun Dec 27 01:16:27 2015
@@ -660,8 +660,7 @@ ASTContext::getCanonicalTemplateTemplate
nullptr,
TemplateParameterList::Create(*this, SourceLocation(),
SourceLocation(),
- CanonParams.data(),
- CanonParams.size(),
+ CanonParams,
SourceLocation()));
// Get the new insert position for the node we care about.
Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=256463&r1=256462&r2=256463&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Sun Dec 27 01:16:27 2015
@@ -2144,7 +2144,7 @@ TemplateParameterList *ASTNodeImporter::
return TemplateParameterList::Create(Importer.getToContext(),
Importer.Import(Params->getTemplateLoc()),
Importer.Import(Params->getLAngleLoc()),
- ToParams.data(), ToParams.size(),
+ ToParams,
Importer.Import(Params->getRAngleLoc()));
}
Modified: cfe/trunk/lib/AST/DeclTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclTemplate.cpp?rev=256463&r1=256462&r2=256463&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclTemplate.cpp (original)
+++ cfe/trunk/lib/AST/DeclTemplate.cpp Sun Dec 27 01:16:27 2015
@@ -30,10 +30,10 @@ using namespace clang;
TemplateParameterList::TemplateParameterList(SourceLocation TemplateLoc,
SourceLocation LAngleLoc,
- NamedDecl **Params, unsigned NumParams,
+ ArrayRef<NamedDecl *> Params,
SourceLocation RAngleLoc)
: TemplateLoc(TemplateLoc), LAngleLoc(LAngleLoc), RAngleLoc(RAngleLoc),
- NumParams(NumParams), ContainsUnexpandedParameterPack(false) {
+ NumParams(Params.size()), ContainsUnexpandedParameterPack(false) {
assert(this->NumParams == NumParams && "Too many template parameters");
for (unsigned Idx = 0; Idx < NumParams; ++Idx) {
NamedDecl *P = Params[Idx];
@@ -54,14 +54,13 @@ TemplateParameterList::TemplateParameter
}
}
-TemplateParameterList *
-TemplateParameterList::Create(const ASTContext &C, SourceLocation TemplateLoc,
- SourceLocation LAngleLoc, NamedDecl **Params,
- unsigned NumParams, SourceLocation RAngleLoc) {
- void *Mem = C.Allocate(totalSizeToAlloc<NamedDecl *>(NumParams),
+TemplateParameterList *TemplateParameterList::Create(
+ const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc,
+ ArrayRef<NamedDecl *> Params, SourceLocation RAngleLoc) {
+ void *Mem = C.Allocate(totalSizeToAlloc<NamedDecl *>(Params.size()),
llvm::alignOf<TemplateParameterList>());
return new (Mem) TemplateParameterList(TemplateLoc, LAngleLoc, Params,
- NumParams, RAngleLoc);
+ RAngleLoc);
}
unsigned TemplateParameterList::getMinRequiredArguments() const {
@@ -1212,7 +1211,7 @@ createMakeIntegerSeqParameterList(const
// <typename T, T ...Ints>
NamedDecl *P[2] = {T, N};
auto *TPL = TemplateParameterList::Create(
- C, SourceLocation(), SourceLocation(), P, 2, SourceLocation());
+ C, SourceLocation(), SourceLocation(), P, SourceLocation());
// template <typename T, ...Ints> class IntSeq
auto *TemplateTemplateParm = TemplateTemplateParmDecl::Create(
@@ -1237,7 +1236,7 @@ createMakeIntegerSeqParameterList(const
// template <template <typename T, T ...Ints> class IntSeq, typename T, T N>
return TemplateParameterList::Create(C, SourceLocation(), SourceLocation(),
- Params, 3, SourceLocation());
+ Params, SourceLocation());
}
static TemplateParameterList *createBuiltinTemplateParameterList(
Modified: cfe/trunk/lib/Sema/SemaLambda.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLambda.cpp?rev=256463&r1=256462&r2=256463&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLambda.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLambda.cpp Sun Dec 27 01:16:27 2015
@@ -226,15 +226,16 @@ getGenericLambdaTemplateParameterList(La
if (LSI->GLTemplateParameterList)
return LSI->GLTemplateParameterList;
- if (LSI->AutoTemplateParams.size()) {
+ if (!LSI->AutoTemplateParams.empty()) {
SourceRange IntroRange = LSI->IntroducerRange;
SourceLocation LAngleLoc = IntroRange.getBegin();
SourceLocation RAngleLoc = IntroRange.getEnd();
LSI->GLTemplateParameterList = TemplateParameterList::Create(
SemaRef.Context,
/*Template kw loc*/ SourceLocation(), LAngleLoc,
- (NamedDecl **)LSI->AutoTemplateParams.data(),
- LSI->AutoTemplateParams.size(), RAngleLoc);
+ llvm::makeArrayRef((NamedDecl *const *)LSI->AutoTemplateParams.data(),
+ LSI->AutoTemplateParams.size()),
+ RAngleLoc);
}
return LSI->GLTemplateParameterList;
}
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=256463&r1=256462&r2=256463&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Sun Dec 27 01:16:27 2015
@@ -819,9 +819,10 @@ Sema::ActOnTemplateParameterList(unsigne
if (ExportLoc.isValid())
Diag(ExportLoc, diag::warn_template_export_unsupported);
- return TemplateParameterList::Create(Context, TemplateLoc, LAngleLoc,
- (NamedDecl**)Params.data(),
- Params.size(), RAngleLoc);
+ return TemplateParameterList::Create(
+ Context, TemplateLoc, LAngleLoc,
+ llvm::makeArrayRef((NamedDecl *const *)Params.data(), Params.size()),
+ RAngleLoc);
}
static void SetNestedNameSpecifier(TagDecl *T, const CXXScopeSpec &SS) {
@@ -1938,7 +1939,7 @@ TemplateParameterList *Sema::MatchTempla
// Fabricate an empty template parameter list for the invented header.
return TemplateParameterList::Create(Context, SourceLocation(),
- SourceLocation(), nullptr, 0,
+ SourceLocation(), None,
SourceLocation());
}
Modified: cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp?rev=256463&r1=256462&r2=256463&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp Sun Dec 27 01:16:27 2015
@@ -4045,7 +4045,7 @@ Sema::DeduceAutoType(TypeLoc Type, Expr
QualType TemplArg = QualType(TemplParam->getTypeForDecl(), 0);
NamedDecl *TemplParamPtr = TemplParam;
FixedSizeTemplateParameterListStorage<1> TemplateParamsSt(
- Loc, Loc, &TemplParamPtr, Loc);
+ Loc, Loc, TemplParamPtr, Loc);
QualType FuncParam = SubstituteAutoTransform(*this, TemplArg).Apply(Type);
assert(!FuncParam.isNull() &&
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=256463&r1=256462&r2=256463&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Sun Dec 27 01:16:27 2015
@@ -2767,7 +2767,7 @@ TemplateDeclInstantiator::SubstTemplateP
TemplateParameterList *InstL
= TemplateParameterList::Create(SemaRef.Context, L->getTemplateLoc(),
- L->getLAngleLoc(), &Params.front(), N,
+ L->getLAngleLoc(), Params,
L->getRAngleLoc());
return InstL;
}
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=256463&r1=256462&r2=256463&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Sun Dec 27 01:16:27 2015
@@ -7838,7 +7838,7 @@ ASTReader::ReadTemplateParameterList(Mod
TemplateParameterList* TemplateParams =
TemplateParameterList::Create(Context, TemplateLoc, LAngleLoc,
- Params.data(), Params.size(), RAngleLoc);
+ Params, RAngleLoc);
return TemplateParams;
}
More information about the cfe-commits
mailing list