Issue 144209
Summary run-clang-tidy.py and absolute paths in compile_commands.json
Labels clang-tidy
Assignees
Reporter 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](https://github.com/llvm/llvm-project/blob/07fa6d1d90c714fa269529c3e5004a063d814c4a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py#L526), 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}`

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to