Improve output in compile_commands.json

The link line is not used by clang, but is recorded in the hope that it
is useful for other tools.  Stabilize the output by requesting the
`str`, not the `repr`, of the input nodes.  `repr` in scons-4.4
generates a bare Python repr, rather than any useful text.  In addition
to not being useful, the bare repr exposes the memory address of the
`SCons.Node.FS.File`, which can vary from run to run even with no
changes to the code, causing needless rebuilds of the compilation
database.  The `str` of a node is its filename, which is stable across
runs.
This commit is contained in:
Kp 2023-03-23 01:14:37 +00:00
parent 769164a55b
commit 9b9a9712e4

View file

@ -4207,7 +4207,7 @@ class DXXCommon(LazyObjectConstructor):
# dictionary entry is only present as a convenience to other
# tools which may want to use the compilation database to know
# the link flags.
'file' : str(list(map(repr, source))),
'file' : str(list(map(str, source))),
'output' : str(o),
}
for o in objects])