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

Daniel Albuschat d.albuschat at gmail.com
Wed Jul 17 22:15:03 PDT 2013


2013/7/18 Manuel Klimek <klimek at google.com>

> On Thu, Jul 18, 2013 at 6:36 AM, Sean Silva <silvas at purdue.edu> wrote:
>
>> tl;dr: compiler embeds compilation db info in object files; you can then
>> collect it afterwards with simple tools. Good idea?
>>
>> [snip]

> The basic idea is that instead of generating the compilation database
>> "before compilation, by something that knows about the build a priori",
>> have the compilation database info come out "the back of the compiler a
>> posteriori" and follow the natural flow of information through the build
>> pipeline, and eventually be recovered from build products.
>>
> [snip]

>
> We have done similar things before internally, but considered it more to
> be a hack ;)
>
> I think the direction that we want to go to is to have an option in clang
> to append to a compilation database while running - that way, no
> post-processing step is required, which again needs to be somehow put into
> the build flow. The only part missing is somebody with enough time on their
> hands for whom this is high enough priority.
>

Hello,

by "Compilation Database", do you mean namespace, function, enum, class,
struct definitions, etc.?
Sean, you are basically proposing something that Java and .NET do, I think
- being able to extract this information from compiled binaries.
E.g. in .NET, you can load any .NET dll and load all class declarations
(and dynamically allocate them and call their methods, but that's another
topic that may be built on top of that).

I've used this to build code generators for .NET assemblies, which seems to
be a similar target to your's.

I find this a very good idea and it will be extremely helpful - one of the
many shortcomings of C and C++ are the missing automation tools - offering
a base to build those is one of the main goals of clang, after all.

Having metainformation in compiled binaries will offer a new branch of
possibilities for post-processing C++ sourcecode. This can be the base for
automatic testing and other nifty tools and will be a valuable addition to
C++, in my opinion.

It is important that the structure of the stored metainformation is well
documented and at least there is a semi-standard for it.

Greetings,
Daniel Albuschat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130718/9e7c2918/attachment.html>


More information about the cfe-dev mailing list