mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-28 10:46:11 +00:00
ArrayRef-ize TemplateParameterList. NFC
llvm-svn: 256463
This commit is contained in:
parent
f8423c05ee
commit
902f8c6fcb
@ -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 FixedSizeTemplateParameterListStorage {
|
||||
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.
|
||||
|
@ -660,8 +660,7 @@ ASTContext::getCanonicalTemplateTemplateParmDecl(
|
||||
nullptr,
|
||||
TemplateParameterList::Create(*this, SourceLocation(),
|
||||
SourceLocation(),
|
||||
CanonParams.data(),
|
||||
CanonParams.size(),
|
||||
CanonParams,
|
||||
SourceLocation()));
|
||||
|
||||
// Get the new insert position for the node we care about.
|
||||
|
@ -2144,7 +2144,7 @@ TemplateParameterList *ASTNodeImporter::ImportTemplateParameterList(
|
||||
return TemplateParameterList::Create(Importer.getToContext(),
|
||||
Importer.Import(Params->getTemplateLoc()),
|
||||
Importer.Import(Params->getLAngleLoc()),
|
||||
ToParams.data(), ToParams.size(),
|
||||
ToParams,
|
||||
Importer.Import(Params->getRAngleLoc()));
|
||||
}
|
||||
|
||||
|
@ -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::TemplateParameterList(SourceLocation TemplateLoc,
|
||||
}
|
||||
}
|
||||
|
||||
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 ASTContext &C, DeclContext *DC) {
|
||||
// <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 ASTContext &C, DeclContext *DC) {
|
||||
|
||||
// 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(
|
||||
|
@ -226,15 +226,16 @@ getGenericLambdaTemplateParameterList(LambdaScopeInfo *LSI, Sema &SemaRef) {
|
||||
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;
|
||||
}
|
||||
|
@ -819,9 +819,10 @@ Sema::ActOnTemplateParameterList(unsigned Depth,
|
||||
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::MatchTemplateParametersToScopeSpecifier(
|
||||
|
||||
// Fabricate an empty template parameter list for the invented header.
|
||||
return TemplateParameterList::Create(Context, SourceLocation(),
|
||||
SourceLocation(), nullptr, 0,
|
||||
SourceLocation(), None,
|
||||
SourceLocation());
|
||||
}
|
||||
|
||||
|
@ -4045,7 +4045,7 @@ Sema::DeduceAutoType(TypeLoc Type, Expr *&Init, QualType &Result) {
|
||||
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() &&
|
||||
|
@ -2767,7 +2767,7 @@ TemplateDeclInstantiator::SubstTemplateParams(TemplateParameterList *L) {
|
||||
|
||||
TemplateParameterList *InstL
|
||||
= TemplateParameterList::Create(SemaRef.Context, L->getTemplateLoc(),
|
||||
L->getLAngleLoc(), &Params.front(), N,
|
||||
L->getLAngleLoc(), Params,
|
||||
L->getRAngleLoc());
|
||||
return InstL;
|
||||
}
|
||||
|
@ -7838,7 +7838,7 @@ ASTReader::ReadTemplateParameterList(ModuleFile &F,
|
||||
|
||||
TemplateParameterList* TemplateParams =
|
||||
TemplateParameterList::Create(Context, TemplateLoc, LAngleLoc,
|
||||
Params.data(), Params.size(), RAngleLoc);
|
||||
Params, RAngleLoc);
|
||||
return TemplateParams;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user