DXR Rewrite

DXR Rewrite

DXR Rewrite is a project with the goal of reviving the old DXR tool and build it on top of more modern infrastructure.

Goals

  • Support for C++, IDL, C, JavaScript, and Objective-C, in that order
  • Providing type information, call graphs, etc. across languages
  • Being easy to deploy (developers should be able to build and run it with minimal effort on their own machine)

Non-Goals

  • Text indexing/searching

Example Use Case

A developer interested in running DXR locally should be able to add something like this to their mozconfig:

CC=/path/to/dxr-indexer
CXX=/path/to/dxr-indexer++
LD=/path/to/dxr-linker

And proceed with a normal build, and at the end, run the web server locally and point it to the generated database.

Phases

C++

  1. Build a compiler replacement tool on top of Clang's libindex.  (See the slides and video on the talk labeled "libclang: Thinking Beyond the Compiler" here for an introduction)
  2. Make it emit .o files containing type information required for DXR.
  3. Create a linker replacement tool which extracts the type information from the "compiled" files and generates the full database in DXR's format.

IDL

  1. Build an IDL compiler replacement tool (probably by extending the existing parser) to extract type information for interfaces.
  2. Figure out how to map those information from the information generated from C++ (we need to retarget types defined in the IDL-generated headers to their IDL original definition).
  3. Integrate that into the C++-only DXR from phase 1.

C

  1. The C step might be quite simple, and most of the code from phase 1 can probably be used here directly.
  2. Figure out if there are any C-specific peculiarities we need to handle.
  3. Integrate the C indexer into the C++/IDL DXR.

JS

  1. TBD (should be discussed with the JS team).

Objective C

  1. libindex supports Objective C too, but the API is kind of different.  We need to extend the indexer to support Objective C specific stuff.

UI

DXR's UI, while not perfect, is really good, so we're not very focused on redoing the UI. We will fix it if it needs fixing (it does have a fair number of rough edges), but at this point, rewriting the UI is out of scope.