[cfe-dev] Source code cross reference tool based on libclang

Ehsan Akhgari ehsan.akhgari at gmail.com
Mon Feb 7 11:50:54 PST 2011


On Mon, Feb 7, 2011 at 2:35 PM, Stefan Seefeld <seefeld at sympatico.ca> wrote:

> On 2011-02-07 14:03, Ehsan Akhgari wrote:
> > Hi all,
> >
> > We're thinking about building a web-based source code cross reference
> > tool based on libclang, which uses type information, call graphs,
> > etc.  So before we start writing this tool, I wanted to ask you guys
> > if you know of any such tool which is already available.  I have not
> > been able to find one, but I'm sure that you guys should know about it
> > if one exists.
>
> Hi Ehsan,
>

Hi Stefan,


> I have been working on Synopsis (http://synopsis.fresco.org), which
> started as a source code documentation tool (similar to doxygen), but
> with many more features. In particular, at some point we introduced an
> "SXR" mode (akin to LXR: http://lxr.linux.no). In contrast to LXR,
> however, Synopsis / SXR will use actual type and symbol information for
> the cross-referencing, so instead of just looking up via text matching,
> Synopsis supports C++ symbol lookup.
>
> I have been working on a new version of Synopsis that uses libclang as
> its CPP/C/C++ parser, and hope to be able to announce a first version
> with that new frontend soon after an LLVM version is released that
> contains all the required bug fixes and feature additions to CLang that
> Synopsis depends on. (I'm right now working off LLVM trunk.)
>
> I'd be happy to discuss details concerning what features you are
> interested in, to see how much of it is already supported, and how hard
> it is to implement the remainder.
>

I had actually looked at Synopsis (not the libclang-based version, of
course), but looking at the web site, it seemed to me that the project is
not maintained any more.  I'm happy to hear that is not the case.  :-)

It would be really interesting for us to see your tool.  It's OK that you're
working off of LLVM/clang trunk, that's where we are too!  :-)

In terms of features, what I think we would need is a class library, a
global function library, call graphs (list of callers, callees), type
information (what's the type of this variable), macro expansion information
(what does the compiler see here?), macro instantiation sites (where in the
code is this macro used?), inheritance information, and maybe some other
things which I'm forgetting.

There's this tool called dxr that some of the folks here at Mozilla have
built on top of Dehydra/gcc <http://dxr.mozilla.org/>, but unfortunately it
has a lot of rough edges, not enough documentation (or even people who can
guide others through getting started), and it's Mozilla specific.  What we
have in mind is replacing it with a tool which is better maintained, and is
more fit towards the needs of other projects besides Mozilla as well.

I would love to contribute to SXR if we have the same general picture in our
heads.  :-)


> PS: Unfortunately the Synopsis website is partly broken right now, since
> the old server was replaced and I haven't managed to set up and adjust
> all the services yet that it relies on.
>

Yes, this is very unfortunate.  I think it would be a really good idea to
add a note to the main page saying just that, so that others looking at it
don't get the impression that the project is dead.  :-)

Cheers,
--
Ehsan
<http://ehsanakhgari.org/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110207/d729db62/attachment.html>


More information about the cfe-dev mailing list