BaseOrMemberInitializers(0), NumBaseOrMemberInitializers(0) {
setImplicit(isImplicitlyDeclared);
}
-
- ~CXXConstructorDecl() { delete [] BaseOrMemberInitializers; }
+ virtual void Destroy(ASTContext& C);
public:
static CXXConstructorDecl *Create(ASTContext &C, CXXRecordDecl *RD,
ImplicitlyDefined = ID;
}
- /// arg_iterator - Iterates through the member/base initializer list.
- typedef CXXBaseOrMemberInitializer **arg_iterator;
+ /// init_iterator - Iterates through the member/base initializer list.
+ typedef CXXBaseOrMemberInitializer **init_iterator;
- /// arg_const_iterator - Iterates through the memberbase initializer list.
- typedef CXXBaseOrMemberInitializer * const * arg_const_iterator;
+ /// init_const_iterator - Iterates through the memberbase initializer list.
+ typedef CXXBaseOrMemberInitializer * const * init_const_iterator;
/// begin() - Retrieve an iterator to the first initializer.
- arg_iterator begin() { return BaseOrMemberInitializers; }
+ init_iterator begin() { return BaseOrMemberInitializers; }
/// begin() - Retrieve an iterator to the first initializer.
- arg_const_iterator begin() const { return BaseOrMemberInitializers; }
+ init_const_iterator begin() const { return BaseOrMemberInitializers; }
/// end() - Retrieve an iterator past the last initializer.
- arg_iterator end() {
+ init_iterator end() {
return BaseOrMemberInitializers + NumBaseOrMemberInitializers;
}
/// end() - Retrieve an iterator past the last initializer.
- arg_const_iterator end() const {
+ init_const_iterator end() const {
return BaseOrMemberInitializers + NumBaseOrMemberInitializers;
}
return NumBaseOrMemberInitializers;
}
- void setBaseOrMemberInitializers(CXXBaseOrMemberInitializer **Initializers,
+ void setBaseOrMemberInitializers(ASTContext &C,
+ CXXBaseOrMemberInitializer **Initializers,
unsigned NumInitializers);
/// isDefaultConstructor - Whether this constructor is a default
void
CXXConstructorDecl::setBaseOrMemberInitializers(
+ ASTContext &C,
CXXBaseOrMemberInitializer **Initializers,
unsigned NumInitializers) {
if (NumInitializers > 0) {
NumBaseOrMemberInitializers = NumInitializers;
BaseOrMemberInitializers =
- new CXXBaseOrMemberInitializer*[NumInitializers];
+ new (C, 8) CXXBaseOrMemberInitializer*[NumInitializers];
for (unsigned Idx = 0; Idx < NumInitializers; ++Idx)
BaseOrMemberInitializers[Idx] = Initializers[Idx];
}
}
+void
+CXXConstructorDecl::Destroy(ASTContext& C) {
+ C.Deallocate(BaseOrMemberInitializers);
+ this->~CXXMethodDecl();
+ C.Deallocate((void *)this);
+}
+
CXXConversionDecl *
CXXConversionDecl::Create(ASTContext &C, CXXRecordDecl *RD,
SourceLocation L, DeclarationName N,
return;
}
llvm::DenseMap<void*, CXXBaseOrMemberInitializer *>Members;
-
+ bool err = false;
for (unsigned i = 0; i < NumMemInits; i++) {
CXXBaseOrMemberInitializer *Member =
static_cast<CXXBaseOrMemberInitializer*>(MemInits[i]);
}
Diag(PrevMember->getSourceLocation(), diag::note_previous_initializer)
<< 0;
+ err = true;
}
+ if (!err)
+ Constructor->setBaseOrMemberInitializers(Context,
+ reinterpret_cast<CXXBaseOrMemberInitializer **>(MemInits),
+ NumMemInits);
}
namespace {