Me, 6 months ago: Let's Rewrite It In Rust! I could write tooling to migrate the build from a blob of mud to a DAG, but that sounds like too much up front. I bet I can make all these changes by hand...
Me, 2 months ago: Sigh, that didn't go so well. Let's try again, using a different approach for the refactor...
Me, last week: Sigh, that's not working out, either! Guess we should roll some tooling after all. Let's start simple...
Me, this week: ...aaand I'm basically implementing a linker
The right way to do this would be hooking into the compiler/linker to emit the dependency graph for all functions and types, but I don't know of a convenient way to do that. https://crates.io/crates/clang actually makes this reasonably easy to implement directly, so let's give it a shot.
Plan B is to abuse `gcc -MM`: split every single type and function definition into its own file and use the resulting file-level build graph to determine dependencies between definitions.