[PATCH] D119481: run-clang-tidy: Fix infinite loop on windows

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 24 08:18:00 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG3f0f20366622: run-clang-tidy: Fix infinite loop on windows (authored by JonasToth).
Herald added a project: All.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119481/new/

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
@@ -73,13 +73,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):


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119481.424784.patch
Type: text/x-patch
Size: 794 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220424/5ca0c868/attachment.bin>


More information about the cfe-commits mailing list