]> granicus.if.org Git - clang/commitdiff
Stub out and start using a Decl::Destroy() method.
authorSam Bishop <sam@bishop.dhs.org>
Fri, 11 Apr 2008 15:01:25 +0000 (15:01 +0000)
committerSam Bishop <sam@bishop.dhs.org>
Fri, 11 Apr 2008 15:01:25 +0000 (15:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49532 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclBase.h
lib/AST/Decl.cpp
lib/AST/TranslationUnit.cpp

index d1b48b8a62160d028c3c02006d823f8d8558dade..ec3c753051cc3240b39819f81ebac2ac6cff2457 100644 (file)
@@ -179,6 +179,9 @@ public:
   /// 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.
index 2ef31e42e5423d557d50aefa3b66bc61ad032453..43da07cc245d7d71125637e952b605cf1a272e33 100644 (file)
@@ -329,6 +329,10 @@ const Attr *Decl::getAttrs() const {
   return (*DeclAttrs)[this];
 }
 
+void Decl::Destroy(ASTContext& C) const {
+  C.getAllocator().Deallocate((void *)this);
+}
+
 //===----------------------------------------------------------------------===//
 // DeclContext Implementation
 //===----------------------------------------------------------------------===//
index b3a2e68f60c3696b4592291c82e9ee73cb1e8094..0198f6f1cf7ef9a1fc6af7538eab9002680f5a9e 100644 (file)
@@ -32,7 +32,7 @@ enum { BasicMetadataBlock = 1,
 
 TranslationUnit::~TranslationUnit() {
   for (iterator I=begin(), E=end(); I!=E; ++I) 
-    delete *I;
+    (*I)->Destroy(*Context);
 }
 
 bool clang::EmitASTBitcodeFile(const TranslationUnit& TU,