зеркало из https://github.com/microsoft/clang-1.git
A little ArrayRef'ization.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182074 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
b5eb3f5bf3
Коммит
7a9f7c7c68
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче