Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8218807

Compilation database (compile_commands.json) may contain obsolete items

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b08

      Backports

        Description

        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 to the invocation time of "make compile-commands", which should be a reasonable tradeoff for ensuring that the compilation database contains correct information.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                rwestberg Robin Westberg (Inactive)
                Reporter:
                rwestberg Robin Westberg (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: