Skip to content

Commit 0d3e0c7

Browse files
committed
developer notes
1 parent 8f34682 commit 0d3e0c7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/design-notes.adoc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Design Notes
2+
===========
3+
4+
AST Traversal
5+
~~~~~~~~~~~~~
6+
During the AST traversal stage, the complete AST (generated by the clang frontend) is walked beginning with the root `TranslationUnitDecl` node. It is during this stage that USRs (universal symbol references) are generated and hashed with SHA1 to form the 160 bit `SymbolID` for an entity. With the exception of built-in types, *all* entities referenced in the corpus will be traversed and be assigned a `SymbolID`; including those from the standard library. This is necessary to generate the full interface for user-defined types.
7+
8+
Bitcode
9+
~~~~~~~
10+
AST traversal is performed in parallel on a per-translation-unit basis. To maximize the size of the code base MrDox is capable of processing, `Info` types generated during traversal are serialized to a compressed bitcode representation. Once AST traversal is complete for all translation units, the bitcode is deserialized back into `Info` types, and then merged to form the corpus. The merging step is necessary as there may be multiple identical definitions of the same entity (e.g. for class types, templates, inline functions, etc), as well as functions declared in one translation unit & defined in another.
11+
12+
The Corpus
13+
~~~~~~~~~~
14+
After AST traversal and `Info` merging, the result is stored as a map of `Info`s indexed by their respective `SymbolID`s. Documentation generators may traverse this structure by calling `Corpus::traverse` with a `Corpus::Visitor` derived visitor and the `SymbolID` of the entity to visit (e.g. the global namespace).

0 commit comments

Comments
 (0)