[cfe-dev] compilation db question

Joerg Sonnenberger via cfe-dev cfe-dev at lists.llvm.org
Thu Dec 1 02:52:20 PST 2016


On Thu, Dec 01, 2016 at 08:34:34AM +1100, Laszlo Nagy via cfe-dev wrote:
> - compilation flags like -MD, -MT x, -MF x, etc... might cause "duplicate"
> items in the compilation database. (the only difference would be the
> presence of these flags) i did modify the command line and filter out these
> flags. but if i'm following your logic, tooling libs shall notice that
> there is no semantic difference between the two compilation and run only
> once. (which is not the case now) would you be happy with that?

I'm filtering those out in https://reviews.llvm.org/D27140 for the
self-write logic. Background is that I do not want tools using the
compilation database to accidentally change anything, i.e. rerunning the
tool command should only modify the output file and nothing else.

> - compilations when a single command compiles (and links) files together
> are splitted into multiple entries. `clang one.c two.c` will make
> '[{"file": "one.c", "command": "clang -c one.c"}, {"file": "two.c",
> "command": "clang -c two.c"}]' is such transformation is acceptable for you
> point of view?

Again, that's what the above is implementing. It seems to be the most
useful behavior.

> - about linking. (specially static linking.) how would you record that into
> the existing format?

I explicitly ignore linking right now as the consumers I tried so far
have no way to deal with it anyway.

> - the Bear tool is currently filtering out linker flags. because my
> understanding was that the output will be used by tools which does not go
> beyond compilation. is that a wrong assumption too?

I don't filter out any other flags, just because that would be more work
to do.

Joerg



More information about the cfe-dev mailing list