Stmt refs in serialized AST


the goal is to have a serialized source code representation and references to statements within this code.

As far as I know the only serialization format is the PCH/Module binary format. Unfortunately the ASTWriter and ASTDeserializationListener only expose Decls, Identifiers, Macros and Types - not Stmts/Exprs.

The ASTStmtWriter seems to produce some actual offsets, but this class is entirely internal implementation.

The only other option I see is to store the SourceLocations, but here some info is lost, because multiple AST nodes can be on the same location. Even when using SourceRanges, some nodes like implicit casts introduce ambiguities.

Any pointers would be much appreciated!