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
llvm::PointerIntPair<const TemplateArgument *, 1> StructuredArguments;
unsigned NumStructuredArguments;
+ TemplateArgumentList(const TemplateArgumentList &Other); // DO NOT IMPL
+ void operator=(const TemplateArgumentList &Other); // DO NOT IMPL
public:
/// TemplateArgumentList - If this constructor is passed "true" for 'TakeArgs'
/// it copies them into a locally new[]'d array. If passed "false", then it
TemplateArgumentListBuilder &Builder,
bool TakeArgs);
- /// \brief Produces a shallow copy of the given template argument list
- TemplateArgumentList(const TemplateArgumentList &Other);
+ /// 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.
+ explicit TemplateArgumentList(const TemplateArgumentList *Other);
~TemplateArgumentList();
}
}
-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())
// specialization.
FD->setFunctionTemplateSpecialization(Specialization->getPrimaryTemplate(),
new (Context) TemplateArgumentList(
- *Specialization->getTemplateSpecializationArgs()),
+ Specialization->getTemplateSpecializationArgs()),
/*InsertPos=*/0,
SpecInfo->getTemplateSpecializationKind());