Persistent AST and google sparsehash

Adam Treat treat at
Sat Aug 5 12:05:46 UTC 2006

Sorry to bug, but if we do decide to build serialization into the AST 
generation, then I think this reference could be very handy:


On Saturday 05 August 2006 7:41 am, Adam Treat wrote:
> Hi Roberto,
> I've been experimenting with the google sparsehash.  I have a
> class 'KDevPersistentHash' which wraps the sparsehash in a nice API.
> Currently, I can create and load a sparse hash with key_type = QString and
> value_type = int.
> I'm currently working on using value_type = KDevAST where KDevAST is the
> TranslationUnitAST from the C++ parser.
> This is what I've found...
> The most recent version of sparse_hash_map (this is the one we want since
> it has *ultra low* memory overhead) can hash non POD types.  WOOHOO!  So we
> can definately use this for key_type = QString and value_type = KDevAST.
>  Unfortunately, we have to persist the key value pairs ourselves.  The
> default sparse_hash_map can only serialize extremely *simple* data types. 
> For all complex data types, we have to do it ourselves.  I'm currently
> using QDataStream to serialize my key_type=QString, value_type=int hash,
> but as you know QDataStream will not work on KDevAST pointers ;)
> So, this brings me back to a conversation we had awhile ago.  How do we
> make the AST/codemodel serializable.
> In past conversations you mentioned the idea of using PTL by Thomas
> Gschwind. This is described in this paper:
> I did find two more solutions linked from the paper:
> 1. Texas --
> 2. POST++ --
> I'm not sure about Texas as it is *very* old and requires a version of gdb
> that is completely outdated.  I'm not thrilled about relying upon type
> descriptions from an old version of gdb.
> POST++ seems reasonable enough, but I wonder if it would be easier to just
> implement a serializable interface in the kdevelop-pg ast generator. 
> Perhaps we can provide << and >> operators that write to a QDataStream?
> What do you think?
> Adam
> _______________________________________________
> KDevelop-devel mailing list
> KDevelop-devel at

More information about the KDevelop-devel mailing list