Created a destructor so that the top-level decls can be deleted.

llvm-svn: 49142
This commit is contained in:
Sam Bishop 2008-04-03 05:35:20 +00:00
parent 5981404289
commit 2289459bf6
2 changed files with 7 additions and 0 deletions

View 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; }

View 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) {