On 2019-02-12 09:01, Robin Westberg wrote:
Hi all,
When generating a compilation database by either "make compile-commands" or "make
compile-commands-hotspot", every object file that should be built results in a temporary json
fragment describing the compiler invocation. However, when the final compile_commands.json file is
assembled, all these temporary files are combined, regardless of whether they belong to the current
make invocation or were left behind from a previous one.
This has the unfortunate effect that "make compile-commands" followed by "make
compile-commands-hotspot" generates something very different from an initial invocation of "make
compile-commands-hotspot". Also, if a source file has been removed, it will still retain an entry in the
final compile_commands.json file until the build directory is cleaned. This will lead to errors if generating
an IDE project from the compile_commands.json file.
Proposed solution is to always remove all previous temporary json fragments and
generate them again. This generation is quite fast and only adds a second or two for
repeated invocations of "make compile-commands”, which should be a reasonable
tradeoff for ensuring that the compilation database contains correct information.
Issue: https://bugs.openjdk.java.net/browse/JDK-8218807
Webrev: http://cr.openjdk.java.net/~rwestberg/8218807/
Looks good to me.
/Magnus
Testing: make test-make-compile-commands, build windows, linux, mac, solaris
Best regards,
Robin