[cfe-commits] r49532 - in /cfe/trunk: include/clang/AST/DeclBase.h lib/AST/Decl.cpp lib/AST/TranslationUnit.cpp

Sam Bishop sam at bishop.dhs.org
Fri Apr 11 08:01:25 PDT 2008


Author: sbishop
Date: Fri Apr 11 10:01:25 2008
New Revision: 49532

URL: http://llvm.org/viewvc/llvm-project?rev=49532&view=rev
Log:
Stub out and start using a Decl::Destroy() method.

Modified:
    cfe/trunk/include/clang/AST/DeclBase.h
    cfe/trunk/lib/AST/Decl.cpp
    cfe/trunk/lib/AST/TranslationUnit.cpp

Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=49532&r1=49531&r2=49532&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Fri Apr 11 10:01:25 2008
@@ -179,6 +179,9 @@
   /// Create - Deserialize a Decl from Bitcode.
   static Decl* Create(llvm::Deserializer& D, ASTContext& C);
 
+  /// Destroy - Call destructors and release memory.
+  void Destroy(ASTContext& C) const;
+
 protected:
   /// EmitImpl - Provides the subclass-specific serialization logic for
   ///   serializing out a decl.

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=49532&r1=49531&r2=49532&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Fri Apr 11 10:01:25 2008
@@ -329,6 +329,10 @@
   return (*DeclAttrs)[this];
 }
 
+void Decl::Destroy(ASTContext& C) const {
+  C.getAllocator().Deallocate((void *)this);
+}
+
 //===----------------------------------------------------------------------===//
 // DeclContext Implementation
 //===----------------------------------------------------------------------===//

Modified: cfe/trunk/lib/AST/TranslationUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TranslationUnit.cpp?rev=49532&r1=49531&r2=49532&view=diff

==============================================================================
--- cfe/trunk/lib/AST/TranslationUnit.cpp (original)
+++ cfe/trunk/lib/AST/TranslationUnit.cpp Fri Apr 11 10:01:25 2008
@@ -32,7 +32,7 @@
 
 TranslationUnit::~TranslationUnit() {
   for (iterator I=begin(), E=end(); I!=E; ++I) 
-    delete *I;
+    (*I)->Destroy(*Context);
 }
 
 bool clang::EmitASTBitcodeFile(const TranslationUnit& TU, 





More information about the cfe-commits mailing list