[cfe-dev] [RFC] Embedding compilation database info in object files.

Hinton, Don Don.Hinton at pimco.com
Fri Jul 19 17:43:00 PDT 2013


Hi All:

I realize the main motivation behind a compilation database is to be able to run clang-based tools on a particular source file with the same options used to build it in the first place.  However, unless you also record the link lines, it's difficult to do much more.  For instance, I'd like to be able to analyze large, multi-target, makefile systems that include many executables and libraries developed by many different groups.  That's not easy to do with makefiles, especially if many of them are hand coded in non-standard ways.

If the new clang compilation database could be extended to include link commands, that would really be helpful.  And if the output could be graph friendly, e.g., included a list of edges instead of just the raw compile line, that would be fantastic.

With cmake, you can get the link lines by cat'ing all the link.txt files, but you still need to parse them to create a graph - you really need to parse the compile lines too.  And even if you don't use cmake, you can still get both the compile and link lines for an entire makefile tree by replacing CC, CXX, AR, etc., with echo $PWD and the original command, and running gmake with the -n option.  However, it would be much better to have the real compiler and linker do the parsing.

I've written a parser to consume the makefile output described above and create a graph for analyzing our makefile system, but there's no way I'd be able to re-implement the logic used by a real linker - the compile lines were no problem.  Therefore, I hope you'll consider adding link lines to the database, as well as explicitly including in and out edges for each node.  This way, you'll produce a complete the graph without the need for any additional post-processing.

thanks...
don


This message contains confidential information and is intended only for the individual named. If you are not the named addressee, you should not disseminate, distribute, alter or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmissions cannot be guaranteed to be secure or without error as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender, therefore, does not accept liability for any errors or omissions in the contents of this message which arise during or as a result of e-mail transmission. If verification is required, please request a hard-copy version. This message is provided for information purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments in any jurisdiction.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130720/ea1aaef8/attachment.html>


More information about the cfe-dev mailing list