[PATCH] D39603: [clang-tidy] Support relative paths in run-clang-tidy.py

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 6 02:36:36 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL317468: [clang-tidy] Support relative paths in run-clang-tidy.py (authored by xazax).

Changed prior to commit:
  https://reviews.llvm.org/D39603?vs=121498&id=121705#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39603

Files:
  clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py


Index: clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
===================================================================
--- clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
@@ -68,6 +68,12 @@
   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 @@
 
   # 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:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39603.121705.patch
Type: text/x-patch
Size: 965 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171106/e6eb5223/attachment.bin>


More information about the cfe-commits mailing list