forked from OSchip/llvm-project
parent
4c163a093f
commit
841d8b2610
|
@ -847,7 +847,7 @@ public:
|
|||
/// arguments for a function template, the notion is convenient when
|
||||
/// we need to perform substitutions inside the definition of a function
|
||||
/// template.
|
||||
std::pair<const TemplateArgument *, unsigned> getInjectedTemplateArgs();
|
||||
ArrayRef<TemplateArgument> getInjectedTemplateArgs();
|
||||
|
||||
/// \brief Create a function template node.
|
||||
static FunctionTemplateDecl *Create(ASTContext &C, DeclContext *DC,
|
||||
|
|
|
@ -97,13 +97,6 @@ namespace clang {
|
|||
addOuterTemplateArguments(ArgList(TemplateArgs->data(),
|
||||
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
|
||||
/// list.
|
||||
|
|
|
@ -261,18 +261,17 @@ void FunctionTemplateDecl::addSpecialization(
|
|||
L->AddedCXXTemplateSpecialization(this, Info->Function);
|
||||
}
|
||||
|
||||
std::pair<const TemplateArgument *, unsigned>
|
||||
FunctionTemplateDecl::getInjectedTemplateArgs() {
|
||||
ArrayRef<TemplateArgument> FunctionTemplateDecl::getInjectedTemplateArgs() {
|
||||
TemplateParameterList *Params = getTemplateParameters();
|
||||
Common *CommonPtr = getCommonPtr();
|
||||
if (!CommonPtr->InjectedArgs) {
|
||||
CommonPtr->InjectedArgs
|
||||
= new (getASTContext()) TemplateArgument [Params->size()];
|
||||
GenerateInjectedTemplateArgs(getASTContext(), Params,
|
||||
= new (getASTContext()) TemplateArgument[Params->size()];
|
||||
GenerateInjectedTemplateArgs(getASTContext(), Params,
|
||||
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);
|
||||
unsigned Depth = AliasTemplate->getTemplateParameters()->getDepth();
|
||||
for (unsigned I = 0; I < Depth; ++I)
|
||||
TemplateArgLists.addOuterTemplateArguments(0, 0);
|
||||
TemplateArgLists.addOuterTemplateArguments(None);
|
||||
|
||||
LocalInstantiationScope Scope(*this);
|
||||
InstantiatingTemplate Inst(*this, TemplateLoc, Template);
|
||||
|
|
|
@ -72,7 +72,7 @@ Sema::getTemplateInstantiationArgs(NamedDecl *D,
|
|||
if (TemplateTemplateParmDecl *TTP
|
||||
= dyn_cast<TemplateTemplateParmDecl>(D)) {
|
||||
for (unsigned I = 0, N = TTP->getDepth() + 1; I != N; ++I)
|
||||
Result.addOuterTemplateArguments(0, 0);
|
||||
Result.addOuterTemplateArguments(None);
|
||||
return Result;
|
||||
}
|
||||
}
|
||||
|
@ -116,9 +116,7 @@ Sema::getTemplateInstantiationArgs(NamedDecl *D,
|
|||
} else if (FunctionTemplateDecl *FunTmpl
|
||||
= Function->getDescribedFunctionTemplate()) {
|
||||
// Add the "injected" template arguments.
|
||||
std::pair<const TemplateArgument *, unsigned>
|
||||
Injected = FunTmpl->getInjectedTemplateArgs();
|
||||
Result.addOuterTemplateArguments(Injected.first, Injected.second);
|
||||
Result.addOuterTemplateArguments(FunTmpl->getInjectedTemplateArgs());
|
||||
}
|
||||
|
||||
// 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)) {
|
||||
if (ClassTemplateDecl *ClassTemplate = Rec->getDescribedClassTemplate()) {
|
||||
QualType T = ClassTemplate->getInjectedClassNameSpecialization();
|
||||
const TemplateSpecializationType *TST
|
||||
= cast<TemplateSpecializationType>(Context.getCanonicalType(T));
|
||||
Result.addOuterTemplateArguments(TST->getArgs(), TST->getNumArgs());
|
||||
const TemplateSpecializationType *TST =
|
||||
cast<TemplateSpecializationType>(Context.getCanonicalType(T));
|
||||
Result.addOuterTemplateArguments(
|
||||
llvm::makeArrayRef(TST->getArgs(), TST->getNumArgs()));
|
||||
if (ClassTemplate->isMemberSpecialization())
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue