[cfe-commits] r109379 - in /cfe/trunk: include/clang/AST/Attr.h include/clang/AST/DeclGroup.h lib/AST/AttrImpl.cpp lib/AST/DeclGroup.cpp

Douglas Gregor dgregor at apple.com
Sun Jul 25 11:32:30 PDT 2010


Author: dgregor
Date: Sun Jul 25 13:32:30 2010
New Revision: 109379

URL: http://llvm.org/viewvc/llvm-project?rev=109379&view=rev
Log:
I lied. Kill off a few more Destroy methods

Modified:
    cfe/trunk/include/clang/AST/Attr.h
    cfe/trunk/include/clang/AST/DeclGroup.h
    cfe/trunk/lib/AST/AttrImpl.cpp
    cfe/trunk/lib/AST/DeclGroup.cpp

Modified: cfe/trunk/include/clang/AST/Attr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Attr.h?rev=109379&r1=109378&r2=109379&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Attr.h (original)
+++ cfe/trunk/include/clang/AST/Attr.h Sun Jul 25 13:32:30 2010
@@ -49,6 +49,8 @@
   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:
   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 @@
   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 @@
 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 @@
   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;

Modified: cfe/trunk/include/clang/AST/DeclGroup.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclGroup.h?rev=109379&r1=109378&r2=109379&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclGroup.h (original)
+++ cfe/trunk/include/clang/AST/DeclGroup.h Sun Jul 25 13:32:30 2010
@@ -34,7 +34,6 @@
 
 public:
   static DeclGroup *Create(ASTContext &C, Decl **Decls, unsigned NumDecls);
-  void Destroy(ASTContext& C);
 
   unsigned size() const { return NumDecls; }
 

Modified: cfe/trunk/lib/AST/AttrImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/AttrImpl.cpp?rev=109379&r1=109378&r2=109379&view=diff
==============================================================================
--- cfe/trunk/lib/AST/AttrImpl.cpp (original)
+++ cfe/trunk/lib/AST/AttrImpl.cpp Sun Jul 25 13:32:30 2010
@@ -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 @@
   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 @@
   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;                                        \

Modified: cfe/trunk/lib/AST/DeclGroup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclGroup.cpp?rev=109379&r1=109378&r2=109379&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclGroup.cpp (original)
+++ cfe/trunk/lib/AST/DeclGroup.cpp Sun Jul 25 13:32:30 2010
@@ -30,9 +30,3 @@
   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);
-}





More information about the cfe-commits mailing list