Skip to content

run-clang-tidy.py and absolute paths in compile_commands.json #144209

Open
@pozzugno

Description

@pozzugno

In my cmake build system, compile_commands.json contains absolute paths both for "directory" and "source". So the script run-clang-tidy.py doesn't work here, when tries to calculates the absolute path of a source file joining "directory" and "file" paths.

I think the script assumes "file" path is always relative to "directory" path, but it isn't true in general.

One fix could be:

files = {e["file"] if os.path.isabs(e["file"]) else os.path.abspath(os.path.join(e["directory"], e["file"])) for e in database}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions