summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
authorAbramo Bagnara <abramo.bagnara@gmail.com>2010-05-20 15:32:11 +0000
committerAbramo Bagnara <abramo.bagnara@gmail.com>2010-05-20 15:32:11 +0000
commit02ccd28a92b1b3465fc2102ada983709e5ed407d (patch)
treed5e8cccf856f88256037e093484c107ff24c0556 /clang/lib/Sema/SemaTemplate.cpp
parent80a9608442b4d6360fd2dacd9c3b37bdbe61e38a (diff)
downloadbcm5719-llvm-02ccd28a92b1b3465fc2102ada983709e5ed407d.tar.gz
bcm5719-llvm-02ccd28a92b1b3465fc2102ada983709e5ed407d.zip
Added TemplateArgumentListInfo to FunctionTemplateSpecializationInfo.
llvm-svn: 104226
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp42
1 files changed, 18 insertions, 24 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 8eab30bd366..6a4f34731ea 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -4219,10 +4219,10 @@ Sema::CheckDependentFunctionTemplateSpecialization(FunctionDecl *FD,
return false;
}
-/// \brief Perform semantic analysis for the given function template
+/// \brief Perform semantic analysis for the given function template
/// specialization.
///
-/// This routine performs all of the semantic analysis required for an
+/// This routine performs all of the semantic analysis required for an
/// explicit function template specialization. On successful completion,
/// the function declaration \p FD will become a function template
/// specialization.
@@ -4230,24 +4230,14 @@ Sema::CheckDependentFunctionTemplateSpecialization(FunctionDecl *FD,
/// \param FD the function declaration, which will be updated to become a
/// 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,
-/// if any.
-///
-/// \param NumExplicitTemplateArgs the number of explicitly-provided template
-/// arguments. This number may be zero even when HasExplicitTemplateArgs is
-/// true as in, e.g., \c void sort<>(char*, char*);
+/// \param ExplicitTemplateArgs the explicitly-provided template arguments,
+/// 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 RAngleLoc the location of the right angle bracket ('>'), if
-/// template arguments were explicitly provided.
-///
-/// \param PrevDecl the set of declarations that
-bool
+/// \param PrevDecl the set of declarations that may be specialized by
+/// this function specialization.
+bool
Sema::CheckFunctionTemplateSpecialization(FunctionDecl *FD,
const TemplateArgumentListInfo *ExplicitTemplateArgs,
LookupResult &Previous) {
@@ -4349,12 +4339,16 @@ Sema::CheckFunctionTemplateSpecialization(FunctionDecl *FD,
// Turn the given function declaration into a function template
// specialization, with the template arguments from the previous
// 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(),
- new (Context) TemplateArgumentList(
- Specialization->getTemplateSpecializationArgs()),
- /*InsertPos=*/0,
- SpecInfo->getTemplateSpecializationKind());
-
+ TemplArgs, /*InsertPos=*/0,
+ SpecInfo->getTemplateSpecializationKind(),
+ TemplArgsAsWritten);
+
// The "previous declaration" for this function template specialization is
// the prior function template specialization.
Previous.clear();
OpenPOWER on IntegriCloud