diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-06-22 09:54:51 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-06-22 09:54:51 +0000 |
commit | d0913557c800c8a712fb554032a833619f23bc56 (patch) | |
tree | f362f6c572d3716f528310b9e4af1f065e0bd55e /lib/AST/DeclTemplate.cpp | |
parent | e1403d2dcb06fc306e186c787a7bd0ca30e06ede (diff) |
Make it easier to read/write the template part of FunctionDecl.
Introduce:
-FunctionDecl::getTemplatedKind() which returns an enum signifying what kind of templated
FunctionDecl it is.
-An overload of FunctionDecl::setFunctionTemplateSpecialization() which accepts arrays of
TemplateArguments and TemplateArgumentLocs
-A constructor to TemplateArgumentList which accepts an array of TemplateArguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106532 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclTemplate.cpp')
-rw-r--r-- | lib/AST/DeclTemplate.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/AST/DeclTemplate.cpp b/lib/AST/DeclTemplate.cpp index a318de656f..3ac32bc80b 100644 --- a/lib/AST/DeclTemplate.cpp +++ b/lib/AST/DeclTemplate.cpp @@ -391,6 +391,22 @@ TemplateArgumentList::TemplateArgumentList(ASTContext &Context, } } +TemplateArgumentList::TemplateArgumentList(ASTContext &Context, + unsigned NumArgs, + const TemplateArgument *Args) + : NumFlatArguments(NumArgs), + NumStructuredArguments(NumArgs) { + + TemplateArgument *NewArgs = new (Context) TemplateArgument[NumArgs]; + std::copy(Args, Args+NumArgs, NewArgs); + FlatArguments.setPointer(NewArgs); + FlatArguments.setInt(1); // Owns the pointer. + + // Just reuse the flat arguments array. + StructuredArguments.setPointer(NewArgs); + StructuredArguments.setInt(0); // Doesn't own the pointer. +} + /// Produces a shallow copy of the given template argument list. This /// assumes that the input argument list outlives it. This takes the list as /// a pointer to avoid looking like a copy constructor, since this really |