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

Sam Bishop sam at bishop.dhs.org
Wed Apr 2 22:35:20 PDT 2008


Author: sbishop
Date: Thu Apr  3 00:35:20 2008
New Revision: 49142

URL: http://llvm.org/viewvc/llvm-project?rev=49142&view=rev
Log:
Created a destructor so that the top-level decls can be deleted.

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

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

==============================================================================
--- cfe/trunk/include/clang/AST/TranslationUnit.h (original)
+++ cfe/trunk/include/clang/AST/TranslationUnit.h Thu Apr  3 00:35:20 2008
@@ -42,6 +42,8 @@
   explicit TranslationUnit(const LangOptions& lopt)
     : LangOpts(lopt), Context(NULL) {}
 
+  ~TranslationUnit();
+
   void setContext(ASTContext* context) { Context = context; }
   ASTContext* getContext() const { return Context; }
   

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

==============================================================================
--- cfe/trunk/lib/AST/TranslationUnit.cpp (original)
+++ cfe/trunk/lib/AST/TranslationUnit.cpp Thu Apr  3 00:35:20 2008
@@ -30,6 +30,11 @@
        ASTContextBlock = 2,
        DeclsBlock = 3 };
 
+TranslationUnit::~TranslationUnit()
+{
+  for (iterator I=begin(), E=end(); I!=E; ++I) 
+    delete *I;
+}
 
 bool clang::EmitASTBitcodeFile(const TranslationUnit& TU, 
                                const llvm::sys::Path& Filename) {  





More information about the cfe-commits mailing list