Friday, June 17, 2011

Alpha release of dxr

I am pleased to announce an alpha release of DXR built on top of Clang. A live demo of DXR can be found at http://dxr.mozilla.org/clang/, which is an index of a relatively recent copy of the Clang source code. Since this is merely an alpha release, expect to find bugs and inconsistencies in the output. For more information, you can go to #static on irc.mozilla.org or contact the static analysis mailing list. A list of most of the bugs I am aware of is at the end of this blog post.

So what is DXR? DXR is a smart code browser that works by using instrumented compilers to use what the compiler knows about the code to provide a database of the code. For C and C++ in particular, using an instrumented compiler is necessary, since it is the only reliable way to fix the issue of macros. Take, for instance, RecursiveASTVistor in the Clang codebase. Most of the almost 1200 functions are defined via macros as opposed to in raw code; as a consequence, the doxygen output for this class is useless: as far as I can tell, there are only five methods I can override to visit AST nodes. On the other hand, DXR neatly tells me all of the methods that are defined, and can point me to the place where that function is defined (within the macro, of course).

Where can you get the code? DXR is available both as a github repository (use the dxr-clang branch) and as a Mercurial repository. Instructions on how to use can be found on the wiki page.

The following is a list of known problems:

  • Links occur at odd boundaries
  • Some lines have id="l234"/> prepended
  • Non-root installs (i.e., installing to http://dxr.mozilla.org/clang/) cause issues. Interestingly, refreshing the page often causes things to work.
  • There is a long list of scrolling text when compiling code. Ignore it.
  • HTML generation produces IndexErrors
  • .csv files are created in the source directory and HTML code is generated.
  • Inheritance searches don't match the full hierarchy, only one or two levels.

8 comments:

Benoit Jacob said...

Really great news. How well are C++ templates supported? I'm considering using this for a project that uses a lot of template metaprogramming. It would be nice to be able to search for templates, know what type is a template specialization of what other, search for typedefs, search for integer constants (static const int, enum values, template parameters...)

Joshua Cranmer said...

So far, I haven't really started worrying about templates, but I should be able to make that sort of stuff possible in future releases.

Jim Rhodes said...

I think these problems are solved now. I want you to check this ieee format example. It's my recommendation for you.

Unknown said...

This is a nice article you shared with great information. Thanks for giving such wonderful information. I hope you will publish again such type of post. Also, please check out write and get paid instantly 

Gammi said...

Very complete work, very professional level, I like it very much. what is Duolingo English test

Unknown said...

Thanks for sharing your amazing thoughts. It’s a really nice and well-explained blog. Are you looking for 50 best girlfriend getaways 

Jamie Starr said...

Personally, if all web owners and bloggers made good content as you did, the net will be much more useful than ever before. You might also like rug doctor rental prices

Jamie Starr said...

college dorm party

dorm room party

dorm party

college dorm parties

college dorm party

collage dorm room party

what is a collage dorm party

what is collage dorm party