Febbe created this revision.
Herald added a subscriber: carlosgalvezp.
Febbe requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119481

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


Index: clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
===================================================================
--- clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
@@ -64,13 +64,14 @@
 
 def find_compilation_database(path):
   """Adjusts the directory until a compilation database is found."""
-  result = './'
+  result = os.path.realpath('./')
   while not os.path.isfile(os.path.join(result, path)):
-    if os.path.realpath(result) == '/':
+    parent = os.path.dirname(result)    
+    if result == parent:
       print('Error: could not find compilation database.')
       sys.exit(1)
-    result += '../'
-  return os.path.realpath(result)
+    result = parent
+  return result
 
 
 def make_absolute(f, directory):


Index: clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
===================================================================
--- clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
@@ -64,13 +64,14 @@
 
 def find_compilation_database(path):
   """Adjusts the directory until a compilation database is found."""
-  result = './'
+  result = os.path.realpath('./')
   while not os.path.isfile(os.path.join(result, path)):
-    if os.path.realpath(result) == '/':
+    parent = os.path.dirname(result)    
+    if result == parent:
       print('Error: could not find compilation database.')
       sys.exit(1)
-    result += '../'
-  return os.path.realpath(result)
+    result = parent
+  return result
 
 
 def make_absolute(f, directory):
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to