Page MenuHomePhabricator

[CompilationDatabase] remove duplicate elements

Authored by rizsotto.mailinglist on Mar 15 2017, 3:05 AM.



Hi Guys,

I would refer to an earlier conversation on the cfe-dev list...

On Wed, Nov 30, 2016 at 10:34 PM Laszlo Nagy <> 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?

If there's no semantic difference, I'd argue that there should only be one entry in the compilation db. On the other hand, I'd not object to patches making the tooling infra deduplicate :)

So, I'm preparing a patch to get rid of duplicate compilation database entries. The current version is just a scratch, did not implemented the filtering itself, but just studied how this can be done. Looking forward for you comments, ideas!

Diff Detail

Event Timeline

Implemented preprocessor flag filtering.

joerg edited edge metadata.Mar 19 2017, 4:49 AM

Personally, I think this should have been handled by whatever tool created the JSON database file in first place.

All right, then everything stays the same. :)