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

Chris Lattner sabre at nondot.org
Fri Mar 27 21:00:23 PDT 2009


Author: lattner
Date: Fri Mar 27 23:00:23 2009
New Revision: 67906

URL: http://llvm.org/viewvc/llvm-project?rev=67906&view=rev
Log:
simplify away some dead ownership stuff, TranslationUnit is now
just a wrapper around ASTContext.

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=67906&r1=67905&r2=67906&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/TranslationUnit.h (original)
+++ cfe/trunk/include/clang/AST/TranslationUnit.h Fri Mar 27 23:00:23 2009
@@ -32,14 +32,13 @@
   
 class TranslationUnit {
   ASTContext* Context;
-  bool OwnsMetaData;
 
   // The default ctor is only invoked during deserialization.
-  explicit TranslationUnit() : Context(NULL), OwnsMetaData(true){}
+  explicit TranslationUnit() : Context(NULL) {}
   
 public:
   explicit TranslationUnit(ASTContext& Ctx)
-    : Context(&Ctx), OwnsMetaData(false) {}
+    : Context(&Ctx){}
 
   ~TranslationUnit();
 

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

==============================================================================
--- cfe/trunk/lib/AST/TranslationUnit.cpp (original)
+++ cfe/trunk/lib/AST/TranslationUnit.cpp Fri Mar 27 23:00:23 2009
@@ -28,15 +28,6 @@
 
 
 TranslationUnit::~TranslationUnit() {
-  if (OwnsMetaData && Context) {
-    // The ASTContext object has the sole references to the IdentifierTable
-    // Selectors, and the Target information.  Go and delete them, since
-    // the TranslationUnit effectively owns them.
-    delete &Context->Idents;
-    delete &Context->Selectors;
-    delete &Context->Target;
-    delete Context;
-  }  
 }
 
 bool clang::EmitASTBitcodeBuffer(const ASTContext &Ctx, 





More information about the cfe-commits mailing list