diff options
| author | Gabor Horvath <xazax.hun@gmail.com> | 2017-11-06 10:36:02 +0000 |
|---|---|---|
| committer | Gabor Horvath <xazax.hun@gmail.com> | 2017-11-06 10:36:02 +0000 |
| commit | 8de900ae1f84b0e8a0d2daa228ab2348b51f7c39 (patch) | |
| tree | 6e27e1067cb880e45a6c6b8f96544388592e8c31 /clang-tools-extra/clang-tidy/tool/run-clang-tidy.py | |
| parent | 53d28a9101f4756859c3d1f73843bc58be50662e (diff) | |
| download | bcm5719-llvm-8de900ae1f84b0e8a0d2daa228ab2348b51f7c39.tar.gz bcm5719-llvm-8de900ae1f84b0e8a0d2daa228ab2348b51f7c39.zip | |
[clang-tidy] Support relative paths in run-clang-tidy.py
Unfortunately, these python scripts are not tested currently. I did the testing
manually on LLVM by editing the CMake generated compilation database to
contain relative paths for some of the files.
Differential Revision: https://reviews.llvm.org/D39603
llvm-svn: 317468
Diffstat (limited to 'clang-tools-extra/clang-tidy/tool/run-clang-tidy.py')
| -rwxr-xr-x | clang-tools-extra/clang-tidy/tool/run-clang-tidy.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py index 7792c5a197f..15b21d762a7 100755 --- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py +++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py @@ -68,6 +68,12 @@ def find_compilation_database(path): return os.path.realpath(result) +def make_absolute(f, directory): + if os.path.isabs(f): + return f + return os.path.normpath(os.path.join(directory, f)) + + def get_tidy_invocation(f, clang_tidy_binary, checks, tmpdir, build_path, header_filter, extra_arg, extra_arg_before, quiet): """Gets a command line for clang-tidy.""" @@ -223,7 +229,8 @@ def main(): # Load the database and extract all files. database = json.load(open(os.path.join(build_path, db_path))) - files = [entry['file'] for entry in database] + files = [make_absolute(entry['file'], entry['directory']) + for entry in database] max_task = args.j if max_task == 0: |

