forked from OSchip/llvm-project
parent
4c163a093f
commit
841d8b2610
|
@ -847,7 +847,7 @@ public:
|
||||||
/// arguments for a function template, the notion is convenient when
|
/// arguments for a function template, the notion is convenient when
|
||||||
/// we need to perform substitutions inside the definition of a function
|
/// we need to perform substitutions inside the definition of a function
|
||||||
/// template.
|
/// template.
|
||||||
std::pair<const TemplateArgument *, unsigned> getInjectedTemplateArgs();
|
ArrayRef<TemplateArgument> getInjectedTemplateArgs();
|
||||||
|
|
||||||
/// \brief Create a function template node.
|
/// \brief Create a function template node.
|
||||||
static FunctionTemplateDecl *Create(ASTContext &C, DeclContext *DC,
|
static FunctionTemplateDecl *Create(ASTContext &C, DeclContext *DC,
|
||||||
|
|
|
@ -98,13 +98,6 @@ namespace clang {
|
||||||
TemplateArgs->size()));
|
TemplateArgs->size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Add a new outmost level to the multi-level template argument
|
|
||||||
/// list.
|
|
||||||
void addOuterTemplateArguments(const TemplateArgument *Args,
|
|
||||||
unsigned NumArgs) {
|
|
||||||
addOuterTemplateArguments(ArgList(Args, NumArgs));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// \brief Add a new outmost level to the multi-level template argument
|
/// \brief Add a new outmost level to the multi-level template argument
|
||||||
/// list.
|
/// list.
|
||||||
void addOuterTemplateArguments(ArgList Args) {
|
void addOuterTemplateArguments(ArgList Args) {
|
||||||
|
|
|
@ -261,8 +261,7 @@ void FunctionTemplateDecl::addSpecialization(
|
||||||
L->AddedCXXTemplateSpecialization(this, Info->Function);
|
L->AddedCXXTemplateSpecialization(this, Info->Function);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<const TemplateArgument *, unsigned>
|
ArrayRef<TemplateArgument> FunctionTemplateDecl::getInjectedTemplateArgs() {
|
||||||
FunctionTemplateDecl::getInjectedTemplateArgs() {
|
|
||||||
TemplateParameterList *Params = getTemplateParameters();
|
TemplateParameterList *Params = getTemplateParameters();
|
||||||
Common *CommonPtr = getCommonPtr();
|
Common *CommonPtr = getCommonPtr();
|
||||||
if (!CommonPtr->InjectedArgs) {
|
if (!CommonPtr->InjectedArgs) {
|
||||||
|
@ -272,7 +271,7 @@ FunctionTemplateDecl::getInjectedTemplateArgs() {
|
||||||
CommonPtr->InjectedArgs);
|
CommonPtr->InjectedArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::make_pair(CommonPtr->InjectedArgs, Params->size());
|
return llvm::makeArrayRef(CommonPtr->InjectedArgs, Params->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
|
@ -2007,7 +2007,7 @@ QualType Sema::CheckTemplateIdType(TemplateName Name,
|
||||||
TemplateArgLists.addOuterTemplateArguments(&TemplateArgs);
|
TemplateArgLists.addOuterTemplateArguments(&TemplateArgs);
|
||||||
unsigned Depth = AliasTemplate->getTemplateParameters()->getDepth();
|
unsigned Depth = AliasTemplate->getTemplateParameters()->getDepth();
|
||||||
for (unsigned I = 0; I < Depth; ++I)
|
for (unsigned I = 0; I < Depth; ++I)
|
||||||
TemplateArgLists.addOuterTemplateArguments(0, 0);
|
TemplateArgLists.addOuterTemplateArguments(None);
|
||||||
|
|
||||||
LocalInstantiationScope Scope(*this);
|
LocalInstantiationScope Scope(*this);
|
||||||
InstantiatingTemplate Inst(*this, TemplateLoc, Template);
|
InstantiatingTemplate Inst(*this, TemplateLoc, Template);
|
||||||
|
|
|
@ -72,7 +72,7 @@ Sema::getTemplateInstantiationArgs(NamedDecl *D,
|
||||||
if (TemplateTemplateParmDecl *TTP
|
if (TemplateTemplateParmDecl *TTP
|
||||||
= dyn_cast<TemplateTemplateParmDecl>(D)) {
|
= dyn_cast<TemplateTemplateParmDecl>(D)) {
|
||||||
for (unsigned I = 0, N = TTP->getDepth() + 1; I != N; ++I)
|
for (unsigned I = 0, N = TTP->getDepth() + 1; I != N; ++I)
|
||||||
Result.addOuterTemplateArguments(0, 0);
|
Result.addOuterTemplateArguments(None);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,9 +116,7 @@ Sema::getTemplateInstantiationArgs(NamedDecl *D,
|
||||||
} else if (FunctionTemplateDecl *FunTmpl
|
} else if (FunctionTemplateDecl *FunTmpl
|
||||||
= Function->getDescribedFunctionTemplate()) {
|
= Function->getDescribedFunctionTemplate()) {
|
||||||
// Add the "injected" template arguments.
|
// Add the "injected" template arguments.
|
||||||
std::pair<const TemplateArgument *, unsigned>
|
Result.addOuterTemplateArguments(FunTmpl->getInjectedTemplateArgs());
|
||||||
Injected = FunTmpl->getInjectedTemplateArgs();
|
|
||||||
Result.addOuterTemplateArguments(Injected.first, Injected.second);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this is a friend declaration and it declares an entity at
|
// If this is a friend declaration and it declares an entity at
|
||||||
|
@ -135,9 +133,10 @@ Sema::getTemplateInstantiationArgs(NamedDecl *D,
|
||||||
} else if (CXXRecordDecl *Rec = dyn_cast<CXXRecordDecl>(Ctx)) {
|
} else if (CXXRecordDecl *Rec = dyn_cast<CXXRecordDecl>(Ctx)) {
|
||||||
if (ClassTemplateDecl *ClassTemplate = Rec->getDescribedClassTemplate()) {
|
if (ClassTemplateDecl *ClassTemplate = Rec->getDescribedClassTemplate()) {
|
||||||
QualType T = ClassTemplate->getInjectedClassNameSpecialization();
|
QualType T = ClassTemplate->getInjectedClassNameSpecialization();
|
||||||
const TemplateSpecializationType *TST
|
const TemplateSpecializationType *TST =
|
||||||
= cast<TemplateSpecializationType>(Context.getCanonicalType(T));
|
cast<TemplateSpecializationType>(Context.getCanonicalType(T));
|
||||||
Result.addOuterTemplateArguments(TST->getArgs(), TST->getNumArgs());
|
Result.addOuterTemplateArguments(
|
||||||
|
llvm::makeArrayRef(TST->getArgs(), TST->getNumArgs()));
|
||||||
if (ClassTemplate->isMemberSpecialization())
|
if (ClassTemplate->isMemberSpecialization())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue