This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Tags out of gcc

> I imagine doing it for c++ and outputting cscope format which is
> reasonably expressive and popular.
> I have no idea how hard it would be, but if I can bug people for help
> I'd be willing to give it a shot.

There are two ways to do this with GCC. One is trivial and one is
hard, but the hard one will likely give better results than the
trivial one.

The trivial one is that you build a plugin
( and hook it at
PLUGIN_FINISH_DECL (and perhaps also at PLUGIN_FINISH_TYPE, not sure
about that). You can then run the plugin in the same command that
compiles your code.

However, this approach has some limitations. It will not handle
preprocessor macros. You'll need to add new plugin hooks to GCC (which
I think would be welcome). And it may not work well in the presence of
compilation errors. It will also be slower than it really needs to be
(although perhaps faster than etags? The GCC parser is very

The hard approach is that you contribute to the effort to make GCC
more modular so that you can call the functions in the C++ parser that
you really need, while ignoring the rest of the compiler. Then, you
will be able to build a stand-alone program that does what you want
without requiring a complete gcc. The way to do this is to join the
GCC project, create a branch and try to build a prototype that doesn't
break the compiler and allows you to achieve what you want. Then,
propose to merge your changes to the main development branch.

I would suggest to start with the trivial approach, get used to GCC
development, then think about what it would take to do the hard



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]