diff options
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 |