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

Sam Bishop sam at bishop.dhs.org
Thu Apr 3 08:39:22 PDT 2008


Sam Bishop wrote:
> +TranslationUnit::~TranslationUnit() {
> +  for (iterator I=begin(), E=end(); I!=E; ++I)
> +    delete *I;
> +}

Meh.  I'm already over my head...

I expect that we would like serializing to be transparent.  In other
words, a new decl and a deserialized decl ought to be equivalent.

Decls are usually created using Create() calls, which takes a pointer to
an ASTContext object.  The deserialization code can't use those Create()
calls, because it's generic LLVM code which doesn't know anything about
the ASTContext class.

The reason that's a problem is because the ASTContext object determines
the allocator to use, at least in the "from source code" case. 
Currently, the allocator is llvm::MallocAllocator, but the
deserialization code uses new.

Any suggestions?  "Here's a simpler project for you..." would work.  ;) 
But I think that once I'm over this hump I can get back to trivial
additions of deletes and destructors...

Thanks,
Sam Bishop




More information about the cfe-commits mailing list