The original motivation for this use-case was code-completion invoked via libclang.
Currently what we do is this:
- We build a module and construct the the comment -> decl mapping.
- We serialize the module to disk (without preserving the mapping).
- We deserialize the module and reconstruct the mapping.
Construction of the mapping isn't exactly cheap - there are expensive SourceLocation decompositions and SourceLocation-based search. While we managed to turn the search into bisection in recent patch, preserving the information still seems a reasonable speed:module size tradeoff.
Original commit by Michael Spencer.
80 columns, please.