[cfe-dev] Clang-based indexer and code navigator
david.tweed at arm.com
Tue Mar 12 06:15:59 PDT 2013
| Over the years I've tried a variety of code browsing tools (for C++ and
| other languages too) but I never stuck with any of them for one simple
| reason: They weren't integrated into my IDE. If I'm looking at a file I
| don't want to switch to a different tool, find that file again, and
| browse from there; then when I find the target, switch back to my IDE
| and find *that* file. I use the term "IDE" loosely here; in my case it's
I fully agree with this point: the biggest problem with a separate code
browser is that I often want to "compare" where I'm working with some
browsed place, which means they both have to be either in the browser tool
or in my editor to minimise the disruption.
| What we really need is a daemon that maintains an index database and
| services requests from the IDE. A while ago Chandler Carruth posted a
| design proposal for a "clang service daemon":
Note that _in purely practical terms_ what's most valuable is having a
"persistent, resumable, updatable" store of info that can be interrogated; I
don't know whether that's significantly less work than having an active
daemon. This comes from the following usage:
1. I rarely lookup stuff in code I've written (with the one exception being
the possibility for a "semantically correct" search and replace). It's
mostly for code in the project that I didn't write.
2. Consequently the vast majority of times I want to update the store of
info are after a VC operation (pull, change branch, etc). These are the kind
of operations where it's possible to script things to kick off a rescan of
changed files (rather than the daemon having to detect changes).
3. Of course you might want to keep the process that answers questions alive
for a whole edit session for performance reasons.
This isn't to say a daemon wouldn't be good, just that you could (for my
usage) get 95% of the benefit without it.
More information about the cfe-dev