mgorny updated this revision to Diff 186205.
mgorny added a comment.

Updated to use `find_executable()` unconditionally.


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

https://reviews.llvm.org/D58001

Files:
  lldb/lit/helper/build.py


Index: lldb/lit/helper/build.py
===================================================================
--- lldb/lit/helper/build.py
+++ lldb/lit/helper/build.py
@@ -283,18 +283,16 @@
                     print('Using alternate compiler "{0}" to match selected 
target.'.format(self.compiler))
 
         if self.mode == 'link' or self.mode == 'compile-and-link':
-            self.linker = self._find_linker('link') if toolchain_type == 
'msvc' else self._find_linker('lld-link')
+            self.linker = self._find_linker('link') if toolchain_type == 
'msvc' else self._find_linker('lld-link', args.tools_dir)
             if not self.linker:
                 raise ValueError('Unable to find an appropriate linker.')
 
         self.compile_env, self.link_env = self._get_visual_studio_environment()
 
-    def _find_linker(self, name):
-        if sys.platform == 'win32':
-            name = name + '.exe'
+    def _find_linker(self, name, search_paths=[]):
         compiler_dir = os.path.dirname(self.compiler)
-        linker_path = os.path.join(compiler_dir, name)
-        if not os.path.exists(linker_path):
+        linker_path = find_executable(name, [compiler_dir] + search_paths)
+        if linker_path is None:
             raise ValueError('Could not find \'{}\''.format(linker_path))
         return linker_path
 


Index: lldb/lit/helper/build.py
===================================================================
--- lldb/lit/helper/build.py
+++ lldb/lit/helper/build.py
@@ -283,18 +283,16 @@
                     print('Using alternate compiler "{0}" to match selected target.'.format(self.compiler))
 
         if self.mode == 'link' or self.mode == 'compile-and-link':
-            self.linker = self._find_linker('link') if toolchain_type == 'msvc' else self._find_linker('lld-link')
+            self.linker = self._find_linker('link') if toolchain_type == 'msvc' else self._find_linker('lld-link', args.tools_dir)
             if not self.linker:
                 raise ValueError('Unable to find an appropriate linker.')
 
         self.compile_env, self.link_env = self._get_visual_studio_environment()
 
-    def _find_linker(self, name):
-        if sys.platform == 'win32':
-            name = name + '.exe'
+    def _find_linker(self, name, search_paths=[]):
         compiler_dir = os.path.dirname(self.compiler)
-        linker_path = os.path.join(compiler_dir, name)
-        if not os.path.exists(linker_path):
+        linker_path = find_executable(name, [compiler_dir] + search_paths)
+        if linker_path is None:
             raise ValueError('Could not find \'{}\''.format(linker_path))
         return linker_path
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to