diff options
author | Chris Lattner <sabre@nondot.org> | 2010-05-20 00:19:09 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-05-20 00:19:09 +0000 |
commit | 885989109ade7cb4dc493e25da41456c64b3cf6a (patch) | |
tree | 017ab1dceafc674b04ef7b5ae154214c0424d18f /lib/AST/DeclTemplate.cpp | |
parent | 56ef550c5eeea0714c635782776389df2a177584 (diff) |
fix the TemplateArgumentList copy constructor to not
be a copy constructor (since it isn't one semantically)
and fix the ownership bits it sets to be correct!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104192 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclTemplate.cpp')
-rw-r--r-- | lib/AST/DeclTemplate.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/AST/DeclTemplate.cpp b/lib/AST/DeclTemplate.cpp index fe17399155..5317c7bff6 100644 --- a/lib/AST/DeclTemplate.cpp +++ b/lib/AST/DeclTemplate.cpp @@ -386,11 +386,15 @@ TemplateArgumentList::TemplateArgumentList(ASTContext &Context, } } -TemplateArgumentList::TemplateArgumentList(const TemplateArgumentList &Other) - : FlatArguments(Other.FlatArguments.getPointer(), 1), - NumFlatArguments(Other.flat_size()), - StructuredArguments(Other.StructuredArguments.getPointer(), 1), - NumStructuredArguments(Other.NumStructuredArguments) { } +/// 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 +/// really isn't safe to use that way. +TemplateArgumentList::TemplateArgumentList(const TemplateArgumentList *Other) + : FlatArguments(Other->FlatArguments.getPointer(), false), + NumFlatArguments(Other->flat_size()), + StructuredArguments(Other->StructuredArguments.getPointer(), false), + NumStructuredArguments(Other->NumStructuredArguments) { } TemplateArgumentList::~TemplateArgumentList() { if (FlatArguments.getInt()) |