I lied. Kill off a few more Destroy methods
llvm-svn: 109379
This commit is contained in:
parent
a9b2dbc1a4
commit
717ceeae76
|
@ -49,6 +49,8 @@ private:
|
|||
bool Inherited : 1;
|
||||
|
||||
protected:
|
||||
virtual ~Attr();
|
||||
|
||||
void* operator new(size_t bytes) throw() {
|
||||
assert(0 && "Attrs cannot be allocated with regular 'new'.");
|
||||
return 0;
|
||||
|
@ -59,11 +61,8 @@ protected:
|
|||
|
||||
protected:
|
||||
Attr(attr::Kind AK) : Next(0), AttrKind(AK), Inherited(false) {}
|
||||
virtual ~Attr() {
|
||||
assert(Next == 0 && "Destroy didn't work");
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void Destroy(ASTContext &C);
|
||||
|
||||
/// \brief Whether this attribute should be merged to new
|
||||
/// declarations.
|
||||
|
@ -110,8 +109,6 @@ protected:
|
|||
AttrWithString(attr::Kind AK, ASTContext &C, llvm::StringRef s);
|
||||
llvm::StringRef getString() const { return llvm::StringRef(Str, StrLen); }
|
||||
void ReplaceString(ASTContext &C, llvm::StringRef newS);
|
||||
public:
|
||||
virtual void Destroy(ASTContext &C);
|
||||
};
|
||||
|
||||
#define DEF_SIMPLE_ATTR(ATTR) \
|
||||
|
@ -357,8 +354,6 @@ class NonNullAttr : public Attr {
|
|||
public:
|
||||
NonNullAttr(ASTContext &C, unsigned* arg_nums = 0, unsigned size = 0);
|
||||
|
||||
virtual void Destroy(ASTContext &C);
|
||||
|
||||
typedef const unsigned *iterator;
|
||||
iterator begin() const { return ArgNums; }
|
||||
iterator end() const { return ArgNums + Size; }
|
||||
|
@ -545,8 +540,6 @@ public:
|
|||
InitPriorityAttr(unsigned priority)
|
||||
: Attr(attr::InitPriority), Priority(priority) {}
|
||||
|
||||
virtual void Destroy(ASTContext &C) { Attr::Destroy(C); }
|
||||
|
||||
unsigned getPriority() const { return Priority; }
|
||||
|
||||
virtual Attr *clone(ASTContext &C) const;
|
||||
|
|
|
@ -34,7 +34,6 @@ private:
|
|||
|
||||
public:
|
||||
static DeclGroup *Create(ASTContext &C, Decl **Decls, unsigned NumDecls);
|
||||
void Destroy(ASTContext& C);
|
||||
|
||||
unsigned size() const { return NumDecls; }
|
||||
|
||||
|
|
|
@ -15,14 +15,7 @@
|
|||
#include "clang/AST/ASTContext.h"
|
||||
using namespace clang;
|
||||
|
||||
void Attr::Destroy(ASTContext &C) {
|
||||
if (Next) {
|
||||
Next->Destroy(C);
|
||||
Next = 0;
|
||||
}
|
||||
this->~Attr();
|
||||
C.Deallocate((void*)this);
|
||||
}
|
||||
Attr::~Attr() { }
|
||||
|
||||
AttrWithString::AttrWithString(attr::Kind AK, ASTContext &C, llvm::StringRef s)
|
||||
: Attr(AK) {
|
||||
|
@ -32,11 +25,6 @@ AttrWithString::AttrWithString(attr::Kind AK, ASTContext &C, llvm::StringRef s)
|
|||
memcpy(const_cast<char*>(Str), s.data(), StrLen);
|
||||
}
|
||||
|
||||
void AttrWithString::Destroy(ASTContext &C) {
|
||||
C.Deallocate(const_cast<char*>(Str));
|
||||
Attr::Destroy(C);
|
||||
}
|
||||
|
||||
void AttrWithString::ReplaceString(ASTContext &C, llvm::StringRef newS) {
|
||||
if (newS.size() > StrLen) {
|
||||
C.Deallocate(const_cast<char*>(Str));
|
||||
|
@ -60,12 +48,6 @@ NonNullAttr::NonNullAttr(ASTContext &C, unsigned* arg_nums, unsigned size)
|
|||
memcpy(ArgNums, arg_nums, sizeof(*ArgNums)*size);
|
||||
}
|
||||
|
||||
void NonNullAttr::Destroy(ASTContext &C) {
|
||||
if (ArgNums)
|
||||
C.Deallocate(ArgNums);
|
||||
Attr::Destroy(C);
|
||||
}
|
||||
|
||||
#define DEF_SIMPLE_ATTR_CLONE(ATTR) \
|
||||
Attr *ATTR##Attr::clone(ASTContext &C) const { \
|
||||
return ::new (C) ATTR##Attr; \
|
||||
|
|
|
@ -30,9 +30,3 @@ DeclGroup::DeclGroup(unsigned numdecls, Decl** decls) : NumDecls(numdecls) {
|
|||
assert(decls);
|
||||
memcpy(this+1, decls, numdecls * sizeof(*decls));
|
||||
}
|
||||
|
||||
void DeclGroup::Destroy(ASTContext& C) {
|
||||
// Decls are destroyed by the DeclContext.
|
||||
this->~DeclGroup();
|
||||
C.Deallocate((void*) this);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue