unsigned size() const { return NumParams; }
- llvm::ArrayRef<NamedDecl*> asArray() {
- return llvm::ArrayRef<NamedDecl*>(begin(), size());
+ ArrayRef<NamedDecl*> asArray() {
+ return ArrayRef<NamedDecl*>(begin(), size());
}
- llvm::ArrayRef<const NamedDecl*> asArray() const {
- return llvm::ArrayRef<const NamedDecl*>(begin(), size());
+ ArrayRef<const NamedDecl*> asArray() const {
+ return ArrayRef<const NamedDecl*>(begin(), size());
}
NamedDecl* getParam(unsigned Idx) {
const TemplateArgument &operator[](unsigned Idx) const { return get(Idx); }
/// \brief Produce this as an array ref.
- llvm::ArrayRef<TemplateArgument> asArray() const {
- return llvm::ArrayRef<TemplateArgument>(data(), size());
+ ArrayRef<TemplateArgument> asArray() const {
+ return ArrayRef<TemplateArgument>(data(), size());
}
/// \brief Retrieve the number of template arguments in this
}
void Profile(llvm::FoldingSetNodeID &ID) {
- Profile(ID, TemplateArguments->data(),
- TemplateArguments->size(),
+ Profile(ID, TemplateArguments->asArray(),
Function->getASTContext());
}
static void
- Profile(llvm::FoldingSetNodeID &ID, const TemplateArgument *TemplateArgs,
- unsigned NumTemplateArgs, ASTContext &Context) {
- ID.AddInteger(NumTemplateArgs);
- for (unsigned Arg = 0; Arg != NumTemplateArgs; ++Arg)
+ Profile(llvm::FoldingSetNodeID &ID, ArrayRef<TemplateArgument> TemplateArgs,
+ ASTContext &Context) {
+ ID.AddInteger(TemplateArgs.size());
+ for (unsigned Arg = 0; Arg != TemplateArgs.size(); ++Arg)
TemplateArgs[Arg].Profile(ID, Context);
}
};
template <class EntryType> typename SpecEntryTraits<EntryType>::DeclType*
findSpecializationImpl(llvm::FoldingSetVector<EntryType> &Specs,
- const TemplateArgument *Args, unsigned NumArgs,
- void *&InsertPos);
+ ArrayRef<TemplateArgument> Args, void *&InsertPos);
struct CommonBase {
CommonBase() : InstantiatedFromMember(nullptr, false) { }
/// \brief Return the specialization with the provided arguments if it exists,
/// otherwise return the insertion point.
- FunctionDecl *findSpecialization(const TemplateArgument *Args,
- unsigned NumArgs, void *&InsertPos);
+ FunctionDecl *findSpecialization(ArrayRef<TemplateArgument> Args,
+ void *&InsertPos);
FunctionTemplateDecl *getCanonicalDecl() override {
return cast<FunctionTemplateDecl>(
SourceRange getSourceRange() const override LLVM_READONLY;
void Profile(llvm::FoldingSetNodeID &ID) const {
- Profile(ID, TemplateArgs->data(), TemplateArgs->size(), getASTContext());
+ Profile(ID, TemplateArgs->asArray(), getASTContext());
}
static void
- Profile(llvm::FoldingSetNodeID &ID, const TemplateArgument *TemplateArgs,
- unsigned NumTemplateArgs, ASTContext &Context) {
- ID.AddInteger(NumTemplateArgs);
- for (unsigned Arg = 0; Arg != NumTemplateArgs; ++Arg)
+ Profile(llvm::FoldingSetNodeID &ID, ArrayRef<TemplateArgument> TemplateArgs,
+ ASTContext &Context) {
+ ID.AddInteger(TemplateArgs.size());
+ for (unsigned Arg = 0; Arg != TemplateArgs.size(); ++Arg)
TemplateArgs[Arg].Profile(ID, Context);
}
/// \brief Return the specialization with the provided arguments if it exists,
/// otherwise return the insertion point.
ClassTemplateSpecializationDecl *
- findSpecialization(const TemplateArgument *Args, unsigned NumArgs,
- void *&InsertPos);
+ findSpecialization(ArrayRef<TemplateArgument> Args, void *&InsertPos);
/// \brief Insert the specified specialization knowing that it is not already
/// in. InsertPos must be obtained from findSpecialization.
/// \brief Return the partial specialization with the provided arguments if it
/// exists, otherwise return the insertion point.
ClassTemplatePartialSpecializationDecl *
- findPartialSpecialization(const TemplateArgument *Args, unsigned NumArgs,
- void *&InsertPos);
+ findPartialSpecialization(ArrayRef<TemplateArgument> Args, void *&InsertPos);
/// \brief Insert the specified partial specialization knowing that it is not
/// already in. InsertPos must be obtained from findPartialSpecialization.
}
void Profile(llvm::FoldingSetNodeID &ID) const {
- Profile(ID, TemplateArgs->data(), TemplateArgs->size(), getASTContext());
+ Profile(ID, TemplateArgs->asArray(), getASTContext());
}
static void Profile(llvm::FoldingSetNodeID &ID,
- const TemplateArgument *TemplateArgs,
- unsigned NumTemplateArgs, ASTContext &Context) {
- ID.AddInteger(NumTemplateArgs);
- for (unsigned Arg = 0; Arg != NumTemplateArgs; ++Arg)
+ ArrayRef<TemplateArgument> TemplateArgs,
+ ASTContext &Context) {
+ ID.AddInteger(TemplateArgs.size());
+ for (unsigned Arg = 0; Arg != TemplateArgs.size(); ++Arg)
TemplateArgs[Arg].Profile(ID, Context);
}
/// \brief Return the specialization with the provided arguments if it exists,
/// otherwise return the insertion point.
VarTemplateSpecializationDecl *
- findSpecialization(const TemplateArgument *Args, unsigned NumArgs,
- void *&InsertPos);
+ findSpecialization(ArrayRef<TemplateArgument> Args, void *&InsertPos);
/// \brief Insert the specified specialization knowing that it is not already
/// in. InsertPos must be obtained from findSpecialization.
/// \brief Return the partial specialization with the provided arguments if it
/// exists, otherwise return the insertion point.
VarTemplatePartialSpecializationDecl *
- findPartialSpecialization(const TemplateArgument *Args, unsigned NumArgs,
- void *&InsertPos);
+ findPartialSpecialization(ArrayRef<TemplateArgument> Args, void *&InsertPos);
/// \brief Insert the specified partial specialization knowing that it is not
/// already in. InsertPos must be obtained from findPartialSpecialization.
// Try to find an existing specialization with these template arguments.
void *InsertPos = nullptr;
ClassTemplateSpecializationDecl *D2
- = ClassTemplate->findSpecialization(TemplateArgs.data(),
- TemplateArgs.size(), InsertPos);
+ = ClassTemplate->findSpecialization(TemplateArgs, InsertPos);
if (D2) {
// We already have a class template specialization with these template
// arguments.
// Try to find an existing specialization with these template arguments.
void *InsertPos = nullptr;
VarTemplateSpecializationDecl *D2 = VarTemplate->findSpecialization(
- TemplateArgs.data(), TemplateArgs.size(), InsertPos);
+ TemplateArgs, InsertPos);
if (D2) {
// We already have a variable template specialization with these template
// arguments.
typename RedeclarableTemplateDecl::SpecEntryTraits<EntryType>::DeclType*
RedeclarableTemplateDecl::findSpecializationImpl(
llvm::FoldingSetVector<EntryType> &Specs,
- const TemplateArgument *Args, unsigned NumArgs,
+ ArrayRef<TemplateArgument> Args,
void *&InsertPos) {
typedef SpecEntryTraits<EntryType> SETraits;
llvm::FoldingSetNodeID ID;
- EntryType::Profile(ID,Args,NumArgs, getASTContext());
+ EntryType::Profile(ID,Args, getASTContext());
EntryType *Entry = Specs.FindNodeOrInsertPos(ID, InsertPos);
return Entry ? SETraits::getMostRecentDecl(Entry) : nullptr;
}
}
FunctionDecl *
-FunctionTemplateDecl::findSpecialization(const TemplateArgument *Args,
- unsigned NumArgs, void *&InsertPos) {
- return findSpecializationImpl(getSpecializations(), Args, NumArgs, InsertPos);
+FunctionTemplateDecl::findSpecialization(ArrayRef<TemplateArgument> Args,
+ void *&InsertPos) {
+ return findSpecializationImpl(getSpecializations(), Args, InsertPos);
}
void FunctionTemplateDecl::addSpecialization(
}
ClassTemplateSpecializationDecl *
-ClassTemplateDecl::findSpecialization(const TemplateArgument *Args,
- unsigned NumArgs, void *&InsertPos) {
- return findSpecializationImpl(getSpecializations(), Args, NumArgs, InsertPos);
+ClassTemplateDecl::findSpecialization(ArrayRef<TemplateArgument> Args,
+ void *&InsertPos) {
+ return findSpecializationImpl(getSpecializations(), Args, InsertPos);
}
void ClassTemplateDecl::AddSpecialization(ClassTemplateSpecializationDecl *D,
}
ClassTemplatePartialSpecializationDecl *
-ClassTemplateDecl::findPartialSpecialization(const TemplateArgument *Args,
- unsigned NumArgs,
+ClassTemplateDecl::findPartialSpecialization(ArrayRef<TemplateArgument> Args,
void *&InsertPos) {
- return findSpecializationImpl(getPartialSpecializations(), Args, NumArgs,
- InsertPos);
+ return findSpecializationImpl(getPartialSpecializations(), Args, InsertPos);
}
void ClassTemplateDecl::AddPartialSpecialization(
}
VarTemplateSpecializationDecl *
-VarTemplateDecl::findSpecialization(const TemplateArgument *Args,
- unsigned NumArgs, void *&InsertPos) {
- return findSpecializationImpl(getSpecializations(), Args, NumArgs, InsertPos);
+VarTemplateDecl::findSpecialization(ArrayRef<TemplateArgument> Args,
+ void *&InsertPos) {
+ return findSpecializationImpl(getSpecializations(), Args, InsertPos);
}
void VarTemplateDecl::AddSpecialization(VarTemplateSpecializationDecl *D,
}
VarTemplatePartialSpecializationDecl *
-VarTemplateDecl::findPartialSpecialization(const TemplateArgument *Args,
- unsigned NumArgs, void *&InsertPos) {
- return findSpecializationImpl(getPartialSpecializations(), Args, NumArgs,
- InsertPos);
+VarTemplateDecl::findPartialSpecialization(ArrayRef<TemplateArgument> Args,
+ void *&InsertPos) {
+ return findSpecializationImpl(getPartialSpecializations(), Args, InsertPos);
}
void VarTemplateDecl::AddPartialSpecialization(
FunctionTemplateDecl *CallOpTemplate = CallOp->getDescribedFunctionTemplate();
void *InsertPos = nullptr;
FunctionDecl *CorrespondingCallOpSpecialization =
- CallOpTemplate->findSpecialization(TAL->data(), TAL->size(), InsertPos);
+ CallOpTemplate->findSpecialization(TAL->asArray(), InsertPos);
assert(CorrespondingCallOpSpecialization);
CallOp = cast<CXXMethodDecl>(CorrespondingCallOpSpecialization);
}
DeducedTemplateArgs = Conv->getTemplateSpecializationArgs();
void *InsertPos = nullptr;
FunctionDecl *CallOpSpec = CallOpTemplate->findSpecialization(
- DeducedTemplateArgs->data(),
- DeducedTemplateArgs->size(),
+ DeducedTemplateArgs->asArray(),
InsertPos);
assert(CallOpSpec &&
"Conversion operator must have a corresponding call operator");
Invoker->getDescribedFunctionTemplate();
void *InsertPos = nullptr;
FunctionDecl *InvokeSpec = InvokeTemplate->findSpecialization(
- DeducedTemplateArgs->data(),
- DeducedTemplateArgs->size(),
+ DeducedTemplateArgs->asArray(),
InsertPos);
assert(InvokeSpec &&
"Must have a corresponding static invoker specialization");
// corresponds to these arguments.
void *InsertPos = nullptr;
ClassTemplateSpecializationDecl *Decl
- = ClassTemplate->findSpecialization(Converted.data(), Converted.size(),
- InsertPos);
+ = ClassTemplate->findSpecialization(Converted, InsertPos);
if (!Decl) {
// This is the first time we have referenced this class template
// specialization. Create the canonical declaration and add it to
if (IsPartialSpecialization)
// FIXME: Template parameter list matters too
- PrevDecl = VarTemplate->findPartialSpecialization(
- Converted.data(), Converted.size(), InsertPos);
+ PrevDecl = VarTemplate->findPartialSpecialization(Converted, InsertPos);
else
- PrevDecl = VarTemplate->findSpecialization(Converted.data(),
- Converted.size(), InsertPos);
+ PrevDecl = VarTemplate->findSpecialization(Converted, InsertPos);
VarTemplateSpecializationDecl *Specialization = nullptr;
// corresponds to these arguments.
void *InsertPos = nullptr;
if (VarTemplateSpecializationDecl *Spec = Template->findSpecialization(
- Converted.data(), Converted.size(), InsertPos))
+ Converted, InsertPos))
// If we already have a variable template specialization, return it.
return Spec;
if (isPartialSpecialization)
// FIXME: Template parameter list matters, too
- PrevDecl
- = ClassTemplate->findPartialSpecialization(Converted.data(),
- Converted.size(),
- InsertPos);
+ PrevDecl = ClassTemplate->findPartialSpecialization(Converted, InsertPos);
else
- PrevDecl
- = ClassTemplate->findSpecialization(Converted.data(),
- Converted.size(), InsertPos);
+ PrevDecl = ClassTemplate->findSpecialization(Converted, InsertPos);
ClassTemplateSpecializationDecl *Specialization = nullptr;
// corresponds to these arguments.
void *InsertPos = nullptr;
ClassTemplateSpecializationDecl *PrevDecl
- = ClassTemplate->findSpecialization(Converted.data(),
- Converted.size(), InsertPos);
+ = ClassTemplate->findSpecialization(Converted, InsertPos);
TemplateSpecializationKind PrevDecl_TSK
= PrevDecl ? PrevDecl->getTemplateSpecializationKind() : TSK_Undeclared;
void *InsertPos = nullptr;
FunctionDecl *SpecFunc
- = FunctionTemplate->findSpecialization(Innermost.begin(), Innermost.size(),
- InsertPos);
+ = FunctionTemplate->findSpecialization(Innermost, InsertPos);
// If we already have a function template specialization, return it.
if (SpecFunc)
void *InsertPos = nullptr;
FunctionDecl *SpecFunc
- = FunctionTemplate->findSpecialization(Innermost.begin(),
- Innermost.size(),
- InsertPos);
+ = FunctionTemplate->findSpecialization(Innermost, InsertPos);
// If we already have a function template specialization, return it.
if (SpecFunc)
// in the member template's set of class template explicit specializations.
void *InsertPos = nullptr;
ClassTemplateSpecializationDecl *PrevDecl =
- InstClassTemplate->findSpecialization(Converted.data(), Converted.size(),
- InsertPos);
+ InstClassTemplate->findSpecialization(Converted, InsertPos);
// Check whether we've already seen a conflicting instantiation of this
// declaration (for instance, if there was a prior implicit instantiation).
// corresponds to these arguments.
void *InsertPos = nullptr;
if (VarTemplateSpecializationDecl *VarSpec = VarTemplate->findSpecialization(
- Converted.data(), Converted.size(), InsertPos))
+ Converted, InsertPos))
// If we already have a variable template specialization, return it.
return VarSpec;
// in the member template's set of class template partial specializations.
void *InsertPos = nullptr;
ClassTemplateSpecializationDecl *PrevDecl
- = ClassTemplate->findPartialSpecialization(Converted.data(),
- Converted.size(), InsertPos);
+ = ClassTemplate->findPartialSpecialization(Converted, InsertPos);
// Build the canonical type that describes the converted template
// arguments of the class template partial specialization.
// in the member template's set of variable template partial specializations.
void *InsertPos = nullptr;
VarTemplateSpecializationDecl *PrevDecl =
- VarTemplate->findPartialSpecialization(Converted.data(), Converted.size(),
- InsertPos);
+ VarTemplate->findPartialSpecialization(Converted, InsertPos);
// Build the canonical type that describes the converted template
// arguments of the variable template partial specialization.
// We avoid getASTContext because a decl in the parent hierarchy may
// be initializing.
llvm::FoldingSetNodeID ID;
- FunctionTemplateSpecializationInfo::Profile(ID, TemplArgs.data(),
- TemplArgs.size(), C);
+ FunctionTemplateSpecializationInfo::Profile(ID, TemplArgs, C);
void *InsertPos = nullptr;
FunctionTemplateDecl::Common *CommonPtr = CanonTemplate->getCommonPtr();
CommonPtr->Specializations.FindNodeOrInsertPos(ID, InsertPos);