forked from OSchip/llvm-project
Added TemplateArgumentListInfo to FunctionTemplateSpecializationInfo.
llvm-svn: 104226
This commit is contained in:
parent
80a9608442
commit
02ccd28a92
|
@ -1424,6 +1424,16 @@ public:
|
||||||
/// returns NULL.
|
/// returns NULL.
|
||||||
const TemplateArgumentList *getTemplateSpecializationArgs() const;
|
const TemplateArgumentList *getTemplateSpecializationArgs() const;
|
||||||
|
|
||||||
|
/// \brief Retrieve the template argument list as written in the sources,
|
||||||
|
/// if any.
|
||||||
|
///
|
||||||
|
/// If this function declaration is not a function template specialization
|
||||||
|
/// or if it had no explicit template argument list, returns NULL.
|
||||||
|
/// Note that it an explicit template argument list may be written empty,
|
||||||
|
/// e.g., template<> void foo<>(char* s);
|
||||||
|
const TemplateArgumentListInfo*
|
||||||
|
getTemplateSpecializationArgsAsWritten() const;
|
||||||
|
|
||||||
/// \brief Specify that this function declaration is actually a function
|
/// \brief Specify that this function declaration is actually a function
|
||||||
/// template specialization.
|
/// template specialization.
|
||||||
///
|
///
|
||||||
|
@ -1443,7 +1453,8 @@ public:
|
||||||
void setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
|
void setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
|
||||||
const TemplateArgumentList *TemplateArgs,
|
const TemplateArgumentList *TemplateArgs,
|
||||||
void *InsertPos,
|
void *InsertPos,
|
||||||
TemplateSpecializationKind TSK = TSK_ImplicitInstantiation);
|
TemplateSpecializationKind TSK = TSK_ImplicitInstantiation,
|
||||||
|
const TemplateArgumentListInfo *TemplateArgsAsWritten = 0);
|
||||||
|
|
||||||
/// \brief Specifies that this function declaration is actually a
|
/// \brief Specifies that this function declaration is actually a
|
||||||
/// dependent function template specialization.
|
/// dependent function template specialization.
|
||||||
|
|
|
@ -283,6 +283,9 @@ public:
|
||||||
/// specialization from the function template.
|
/// specialization from the function template.
|
||||||
const TemplateArgumentList *TemplateArguments;
|
const TemplateArgumentList *TemplateArguments;
|
||||||
|
|
||||||
|
/// \brief The template arguments as written in the sources, if provided.
|
||||||
|
const TemplateArgumentListInfo *TemplateArgumentsAsWritten;
|
||||||
|
|
||||||
/// \brief The point at which this function template specialization was
|
/// \brief The point at which this function template specialization was
|
||||||
/// first instantiated.
|
/// first instantiated.
|
||||||
SourceLocation PointOfInstantiation;
|
SourceLocation PointOfInstantiation;
|
||||||
|
|
|
@ -1289,11 +1289,22 @@ FunctionDecl::getTemplateSpecializationArgs() const {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TemplateArgumentListInfo *
|
||||||
|
FunctionDecl::getTemplateSpecializationArgsAsWritten() const {
|
||||||
|
if (FunctionTemplateSpecializationInfo *Info
|
||||||
|
= TemplateOrSpecialization
|
||||||
|
.dyn_cast<FunctionTemplateSpecializationInfo*>()) {
|
||||||
|
return Info->TemplateArgumentsAsWritten;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FunctionDecl::setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
|
FunctionDecl::setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
|
||||||
const TemplateArgumentList *TemplateArgs,
|
const TemplateArgumentList *TemplateArgs,
|
||||||
void *InsertPos,
|
void *InsertPos,
|
||||||
TemplateSpecializationKind TSK) {
|
TemplateSpecializationKind TSK,
|
||||||
|
const TemplateArgumentListInfo *TemplateArgsAsWritten) {
|
||||||
assert(TSK != TSK_Undeclared &&
|
assert(TSK != TSK_Undeclared &&
|
||||||
"Must specify the type of function template specialization");
|
"Must specify the type of function template specialization");
|
||||||
FunctionTemplateSpecializationInfo *Info
|
FunctionTemplateSpecializationInfo *Info
|
||||||
|
@ -1305,6 +1316,7 @@ FunctionDecl::setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
|
||||||
Info->Template.setPointer(Template);
|
Info->Template.setPointer(Template);
|
||||||
Info->Template.setInt(TSK - 1);
|
Info->Template.setInt(TSK - 1);
|
||||||
Info->TemplateArguments = TemplateArgs;
|
Info->TemplateArguments = TemplateArgs;
|
||||||
|
Info->TemplateArgumentsAsWritten = TemplateArgsAsWritten;
|
||||||
TemplateOrSpecialization = Info;
|
TemplateOrSpecialization = Info;
|
||||||
|
|
||||||
// Insert this function template specialization into the set of known
|
// Insert this function template specialization into the set of known
|
||||||
|
|
|
@ -4230,23 +4230,13 @@ Sema::CheckDependentFunctionTemplateSpecialization(FunctionDecl *FD,
|
||||||
/// \param FD the function declaration, which will be updated to become a
|
/// \param FD the function declaration, which will be updated to become a
|
||||||
/// function template specialization.
|
/// function template specialization.
|
||||||
///
|
///
|
||||||
/// \param HasExplicitTemplateArgs whether any template arguments were
|
|
||||||
/// explicitly provided.
|
|
||||||
///
|
|
||||||
/// \param LAngleLoc the location of the left angle bracket ('<'), if
|
|
||||||
/// template arguments were explicitly provided.
|
|
||||||
///
|
|
||||||
/// \param ExplicitTemplateArgs the explicitly-provided template arguments,
|
/// \param ExplicitTemplateArgs the explicitly-provided template arguments,
|
||||||
/// if any.
|
/// if any. Note that this may be valid info even when 0 arguments are
|
||||||
|
/// explicitly provided as in, e.g., \c void sort<>(char*, char*);
|
||||||
|
/// as it anyway contains info on the angle brackets locations.
|
||||||
///
|
///
|
||||||
/// \param NumExplicitTemplateArgs the number of explicitly-provided template
|
/// \param PrevDecl the set of declarations that may be specialized by
|
||||||
/// arguments. This number may be zero even when HasExplicitTemplateArgs is
|
/// this function specialization.
|
||||||
/// true as in, e.g., \c void sort<>(char*, char*);
|
|
||||||
///
|
|
||||||
/// \param RAngleLoc the location of the right angle bracket ('>'), if
|
|
||||||
/// template arguments were explicitly provided.
|
|
||||||
///
|
|
||||||
/// \param PrevDecl the set of declarations that
|
|
||||||
bool
|
bool
|
||||||
Sema::CheckFunctionTemplateSpecialization(FunctionDecl *FD,
|
Sema::CheckFunctionTemplateSpecialization(FunctionDecl *FD,
|
||||||
const TemplateArgumentListInfo *ExplicitTemplateArgs,
|
const TemplateArgumentListInfo *ExplicitTemplateArgs,
|
||||||
|
@ -4349,11 +4339,15 @@ Sema::CheckFunctionTemplateSpecialization(FunctionDecl *FD,
|
||||||
// Turn the given function declaration into a function template
|
// Turn the given function declaration into a function template
|
||||||
// specialization, with the template arguments from the previous
|
// specialization, with the template arguments from the previous
|
||||||
// specialization.
|
// specialization.
|
||||||
|
// Take copies of (semantic and syntactic) template argument lists.
|
||||||
|
const TemplateArgumentList* TemplArgs = new (Context)
|
||||||
|
TemplateArgumentList(Specialization->getTemplateSpecializationArgs());
|
||||||
|
const TemplateArgumentListInfo* TemplArgsAsWritten = ExplicitTemplateArgs
|
||||||
|
? new (Context) TemplateArgumentListInfo(*ExplicitTemplateArgs) : 0;
|
||||||
FD->setFunctionTemplateSpecialization(Specialization->getPrimaryTemplate(),
|
FD->setFunctionTemplateSpecialization(Specialization->getPrimaryTemplate(),
|
||||||
new (Context) TemplateArgumentList(
|
TemplArgs, /*InsertPos=*/0,
|
||||||
Specialization->getTemplateSpecializationArgs()),
|
SpecInfo->getTemplateSpecializationKind(),
|
||||||
/*InsertPos=*/0,
|
TemplArgsAsWritten);
|
||||||
SpecInfo->getTemplateSpecializationKind());
|
|
||||||
|
|
||||||
// The "previous declaration" for this function template specialization is
|
// The "previous declaration" for this function template specialization is
|
||||||
// the prior function template specialization.
|
// the prior function template specialization.
|
||||||
|
|
Loading…
Reference in New Issue