r/cpp • u/Obvious_Gap_5768 • 2m ago
How close can a C++ call graph get without a build? I scored mine against scip-clang on 8 repos
I've been working on a C++ call graph that needs no build: no compile_commands.json, no platform SDK headers, no generated files. The idea is to make it usable on huge game or embedded codebases where getting a clean compile on the indexing machine is the hard part.
To see how wrong that gets, I scored it against scip-clang (clang's own index) on the same commits. An edge counts as wrong if clang records a different function at that call site, and a sibling overload counts as wrong too.
Precision / recall per repo -
ninja: 0.98 / 0.96
leveldb: 0.96 / 0.91
recast: 0.96 / 0.96
fmt: 0.91 / 0.81
Jolt: 0.92 / 0.80
SFML 3.1 (held out): 0.91 / 0.86
jsoncpp 1.9.6 (held out): 0.94 / 0.80
yaml-cpp (held out): 0.89 / 0.74
Held out means I never looked at those repos while working on it
The hardest part wasn't overloads, it was macros. In a big engine codebase, reflection macros inside class bodies (things like AZ_RTTI(X, "{GUID}", Base);) made the parser lose the class completely. In one engine, 87% of the reflected classes in the headers I sampled just vanished, and their members showed up as loose functions. Blanking those macro lines before parsing brought back 170 of 171.
Templates are the other gap, which is why recall is lowest on fmt and yaml-cpp. A this->size() call into a dependent base can't be pinned without the instantiation, and clang itself leaves some of those unresolved in the template definition.
If you've worked on C++ tooling, which cases gave you the most trouble?