]> granicus.if.org Git - clang/commitdiff
Created a destructor so that the top-level decls can be deleted.
authorSam Bishop <sam@bishop.dhs.org>
Thu, 3 Apr 2008 05:35:20 +0000 (05:35 +0000)
committerSam Bishop <sam@bishop.dhs.org>
Thu, 3 Apr 2008 05:35:20 +0000 (05:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49142 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 2839774eaedad1c5ddca7c61549d19580df71637..0c7d0348da8f8574a9388023b39fe543d19323d1 100644 (file)
@@ -42,6 +42,8 @@ public:
   explicit TranslationUnit(const LangOptions& lopt)
     : LangOpts(lopt), Context(NULL) {}
 
+  ~TranslationUnit();
+
   void setContext(ASTContext* context) { Context = context; }
   ASTContext* getContext() const { return Context; }
   
index fdc37a8443730b66531fe43e6016432325964a04..8211db1b74821482e3a9a85743b6ace8685d9d21 100644 (file)
@@ -30,6 +30,11 @@ enum { BasicMetadataBlock = 1,
        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) {