zturner updated this revision to Diff 174473.
zturner added a comment.
Herald added a subscriber: ki.stfu.

- Added an `__init__.py` to the helper directory.  This is required on Python 2 
to make the import work.
- Changed a bunch of `%cc` substitutions to `%clang`.
- Changed the `%clang_cl` command lines to always pass /c.  This fixes an issue 
where we are unable to automatically locate the installed Visual Studio when 
running from inside of VS.

After this patch, the test run is clean on OSX and awaiting word on whether 
it's clean on Windows (it is for me).

Thanks to @stella.stamenova for the help.


https://reviews.llvm.org/D54567

Files:
  clang/test/lit.cfg.py
  lldb/lit/Breakpoint/case-insensitive.test
  lldb/lit/Breakpoint/case-sensitive.test
  lldb/lit/Expr/TestIRMemoryMap.test
  lldb/lit/Expr/TestIRMemoryMapWindows.test
  lldb/lit/Quit/TestQuitExitCode-30.test
  lldb/lit/Quit/TestQuitExitCode30.test
  lldb/lit/Quit/TestQuitExitCodeHexA.test
  lldb/lit/SymbolFile/DWARF/apple-index-is-used.cpp
  lldb/lit/SymbolFile/DWARF/debug-names-compressed.cpp
  lldb/lit/SymbolFile/DWARF/dwarf5-index-is-used.cpp
  lldb/lit/SymbolFile/DWARF/dwarf5-partial-index.cpp
  lldb/lit/SymbolFile/DWARF/find-basic-function.cpp
  lldb/lit/SymbolFile/DWARF/find-basic-namespace.cpp
  lldb/lit/SymbolFile/DWARF/find-basic-type.cpp
  lldb/lit/SymbolFile/DWARF/find-basic-variable.cpp
  lldb/lit/SymbolFile/DWARF/find-function-regex.cpp
  lldb/lit/SymbolFile/DWARF/find-method-local-struct.cpp
  lldb/lit/SymbolFile/DWARF/find-method.cpp
  lldb/lit/SymbolFile/DWARF/find-qualified-variable.cpp
  lldb/lit/SymbolFile/DWARF/find-type-in-function.cpp
  lldb/lit/SymbolFile/DWARF/find-variable-dwo.cpp
  lldb/lit/SymbolFile/DWARF/find-variable-file.cpp
  lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
  lldb/lit/SymbolFile/NativePDB/bitfields.cpp
  lldb/lit/SymbolFile/NativePDB/disassembly.cpp
  lldb/lit/SymbolFile/NativePDB/function-types-builtins.cpp
  lldb/lit/SymbolFile/NativePDB/function-types-calling-conv.cpp
  lldb/lit/SymbolFile/NativePDB/function-types-classes.cpp
  lldb/lit/SymbolFile/NativePDB/global-classes.cpp
  lldb/lit/SymbolFile/NativePDB/globals-bss.cpp
  lldb/lit/SymbolFile/NativePDB/globals-fundamental.cpp
  lldb/lit/SymbolFile/NativePDB/nested-types.cpp
  lldb/lit/SymbolFile/NativePDB/s_constant.cpp
  lldb/lit/SymbolFile/NativePDB/simple-breakpoints.cpp
  lldb/lit/SymbolFile/NativePDB/source-list.cpp
  lldb/lit/SymbolFile/NativePDB/tag-types.cpp
  lldb/lit/SymbolFile/PDB/ast-restore.test
  lldb/lit/SymbolFile/PDB/calling-conventions.test
  lldb/lit/SymbolFile/PDB/class-layout.test
  lldb/lit/SymbolFile/PDB/compilands.test
  lldb/lit/SymbolFile/PDB/enums-layout.test
  lldb/lit/SymbolFile/PDB/func-symbols.test
  lldb/lit/SymbolFile/PDB/function-level-linking.test
  lldb/lit/SymbolFile/PDB/function-nested-block.test
  lldb/lit/SymbolFile/PDB/pointers.test
  lldb/lit/SymbolFile/PDB/type-quals.test
  lldb/lit/SymbolFile/PDB/typedefs.test
  lldb/lit/SymbolFile/PDB/udt-layout.test
  lldb/lit/SymbolFile/PDB/variables-locations.test
  lldb/lit/SymbolFile/PDB/variables.test
  lldb/lit/SymbolFile/PDB/vbases.test
  lldb/lit/helper/__init__.py
  lldb/lit/helper/toolchain.py
  lldb/lit/lit.cfg.py
  lldb/lit/lit.site.cfg.py.in
  lldb/lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test
  lldb/lit/tools/lldb-mi/breakpoint/break-insert.test
  lldb/lit/tools/lldb-mi/data/data-info-line.test
  lldb/lit/tools/lldb-mi/exec/exec-continue.test
  lldb/lit/tools/lldb-mi/exec/exec-finish.test
  lldb/lit/tools/lldb-mi/exec/exec-interrupt.test
  lldb/lit/tools/lldb-mi/exec/exec-next-instruction.test
  lldb/lit/tools/lldb-mi/exec/exec-next.test
  lldb/lit/tools/lldb-mi/exec/exec-step-instruction.test
  lldb/lit/tools/lldb-mi/exec/exec-step.test
  lldb/lit/tools/lldb-mi/symbol/symbol-list-lines.test
  lldb/lit/tools/lldb-mi/target/target-select-so-path.test
  lldb/test/CMakeLists.txt
  llvm/utils/lit/lit/TestingConfig.py
  llvm/utils/lit/lit/llvm/config.py
  llvm/utils/lit/lit/llvm/subst.py

Index: llvm/utils/lit/lit/llvm/subst.py
===================================================================
--- llvm/utils/lit/lit/llvm/subst.py
+++ llvm/utils/lit/lit/llvm/subst.py
@@ -80,6 +80,7 @@
         self.extra_args = extra_args
         self.key = key
         self.command = command if command is not None else FindTool(key)
+        self.was_resolved = False
         if verbatim:
             self.regex = key
             return
@@ -141,5 +142,6 @@
                 return None
             else:
                 raise 'Unexpected value for ToolSubst.unresolved'
-
+        if command_str:
+            self.was_resolved = True
         return (self.regex, tool_pipe, command_str)
Index: llvm/utils/lit/lit/llvm/config.py
===================================================================
--- llvm/utils/lit/lit/llvm/config.py
+++ llvm/utils/lit/lit/llvm/config.py
@@ -333,7 +333,7 @@
                 self.lit_config.note('using {}: {}'.format(name, tool))
         return tool
 
-    def use_clang(self, required=True):
+    def use_clang(self, additional_tool_dirs=[], additional_flags=[], required=True):
         """Configure the test suite to be able to invoke clang.
 
         Sets up some environment variables important to clang, locates a
@@ -370,32 +370,38 @@
 
         # Tweak the PATH to include the tools dir and the scripts dir.
         # Put Clang first to avoid LLVM from overriding out-of-tree clang builds.
-        possible_paths = ['clang_tools_dir', 'llvm_tools_dir']
-        paths = [getattr(self.config, pp) for pp in possible_paths
+        exe_dir_props = [self.config.name.lower() + '_tools_dir', 'clang_tools_dir', 'llvm_tools_dir']
+        paths = [getattr(self.config, pp) for pp in exe_dir_props
                  if getattr(self.config, pp, None)]
+        paths = additional_tool_dirs + paths
         self.with_environment('PATH', paths, append_path=True)
 
-        paths = [self.config.llvm_shlib_dir, self.config.llvm_libs_dir]
+        lib_dir_props = [self.config.name.lower() + '_libs_dir', 'clang_libs_dir', 'llvm_shlib_dir', 'llvm_libs_dir']
+        paths = [getattr(self.config, pp) for pp in lib_dir_props
+                 if getattr(self.config, pp, None)]
+
         self.with_environment('LD_LIBRARY_PATH', paths, append_path=True)
 
         # Discover the 'clang' and 'clangcc' to use.
 
         self.config.clang = self.use_llvm_tool(
             'clang', search_env='CLANG', required=required)
 
-        self.config.substitutions.append(
-            ('%llvmshlibdir', self.config.llvm_shlib_dir))
-        self.config.substitutions.append(
-            ('%pluginext', self.config.llvm_plugin_ext))
+        shl = getattr(self.config, 'llvm_shlib_dir', None)
+        pext = getattr(self.config, 'llvm_plugin_ext', None)
+        if shl:
+            self.config.substitutions.append(('%llvmshlibdir', shl))
+        if pext:
+            self.config.substitutions.append(('%pluginext', pext))
 
         builtin_include_dir = self.get_clang_builtin_include_dir(self.config.clang)
         tool_substitutions = [
-            ToolSubst('%clang', command=self.config.clang),
-            ToolSubst('%clang_analyze_cc1', command='%clang_cc1', extra_args=['-analyze', '%analyze']),
-            ToolSubst('%clang_cc1', command=self.config.clang, extra_args=['-cc1', '-internal-isystem', builtin_include_dir, '-nostdsysteminc']),
-            ToolSubst('%clang_cpp', command=self.config.clang, extra_args=['--driver-mode=cpp']),
-            ToolSubst('%clang_cl', command=self.config.clang, extra_args=['--driver-mode=cl']),
-            ToolSubst('%clangxx', command=self.config.clang, extra_args=['--driver-mode=g++']),
+            ToolSubst('%clang', command=self.config.clang, extra_args=additional_flags),
+            ToolSubst('%clang_analyze_cc1', command='%clang_cc1', extra_args=['-analyze', '%analyze']+additional_flags),
+            ToolSubst('%clang_cc1', command=self.config.clang, extra_args=['-cc1', '-internal-isystem', builtin_include_dir, '-nostdsysteminc']+additional_flags),
+            ToolSubst('%clang_cpp', command=self.config.clang, extra_args=['--driver-mode=cpp']+additional_flags),
+            ToolSubst('%clang_cl', command=self.config.clang, extra_args=['--driver-mode=cl']+additional_flags),
+            ToolSubst('%clangxx', command=self.config.clang, extra_args=['--driver-mode=g++']+additional_flags),
             ]
         self.add_tool_substitutions(tool_substitutions)
 
@@ -415,55 +421,71 @@
             self.config.substitutions.append(
                 ('%target_itanium_abi_host_triple', ''))
 
-        self.config.substitutions.append(
-            ('%src_include_dir', self.config.clang_src_dir + '/include'))
-
         # FIXME: Find nicer way to prohibit this.
         self.config.substitutions.append(
-            (' clang ', """*** Do not use 'clang' in tests, use '%clang'. ***"""))
+            (' clang ', """\"*** Do not use 'clang' in tests, use '%clang'. ***\""""))
         self.config.substitutions.append(
-            (' clang\+\+ ', """*** Do not use 'clang++' in tests, use '%clangxx'. ***"""))
+            (' clang\+\+ ', """\"*** Do not use 'clang++' in tests, use '%clangxx'. ***\""""))
         self.config.substitutions.append(
             (' clang-cc ',
-             """*** Do not use 'clang-cc' in tests, use '%clang_cc1'. ***"""))
+             """\"*** Do not use 'clang-cc' in tests, use '%clang_cc1'. ***\""""))
+        self.config.substitutions.append(
+            (' clang-cl ',
+             """\"*** Do not use 'clang-cl' in tests, use '%clang_cl'. ***\""""))
         self.config.substitutions.append(
             (' clang -cc1 -analyze ',
-             """*** Do not use 'clang -cc1 -analyze' in tests, use '%clang_analyze_cc1'. ***"""))
+             """\"*** Do not use 'clang -cc1 -analyze' in tests, use '%clang_analyze_cc1'. ***\""""))
         self.config.substitutions.append(
             (' clang -cc1 ',
-             """*** Do not use 'clang -cc1' in tests, use '%clang_cc1'. ***"""))
+             """\"*** Do not use 'clang -cc1' in tests, use '%clang_cc1'. ***\""""))
         self.config.substitutions.append(
             (' %clang-cc1 ',
-             """*** invalid substitution, use '%clang_cc1'. ***"""))
+             """\"*** invalid substitution, use '%clang_cc1'. ***\""""))
         self.config.substitutions.append(
             (' %clang-cpp ',
-             """*** invalid substitution, use '%clang_cpp'. ***"""))
+             """\"*** invalid substitution, use '%clang_cpp'. ***\""""))
         self.config.substitutions.append(
             (' %clang-cl ',
-             """*** invalid substitution, use '%clang_cl'. ***"""))
+             """\"*** invalid substitution, use '%clang_cl'. ***\""""))
 
-    def use_lld(self, required=True):
+    def use_lld(self, additional_tool_dirs=[], required=True):
         """Configure the test suite to be able to invoke lld.
 
         Sets up some environment variables important to lld, locates a
         just-built or installed lld, and add a set of standard
         substitutions useful to any test suite that makes use of lld.
 
         """
-        # Tweak the PATH to include the tools dir
-        tool_dirs = [self.config.llvm_tools_dir]
-        lib_dirs = [self.config.llvm_libs_dir]
-        lld_tools_dir = getattr(self.config, 'lld_tools_dir', None)
-        lld_libs_dir = getattr(self.config, 'lld_libs_dir', None)
 
-        if lld_tools_dir:
-            tool_dirs = tool_dirs + [lld_tools_dir]
-        if lld_libs_dir:
-            lib_dirs = lib_dirs + [lld_libs_dir]
+        # Tweak the PATH to include the tools dir and the scripts dir.
+        exe_dir_props = [self.config.name.lower() + '_tools_dir', 'lld_tools_dir', 'llvm_tools_dir']
+        paths = [getattr(self.config, pp) for pp in exe_dir_props
+                 if getattr(self.config, pp, None)]
+        paths = additional_tool_dirs + paths
+        self.with_environment('PATH', paths, append_path=True)
 
-        self.with_environment('PATH', tool_dirs, append_path=True)
-        self.with_environment('LD_LIBRARY_PATH', lib_dirs, append_path=True)
+        lib_dir_props = [self.config.name.lower() + '_libs_dir', 'lld_libs_dir', 'llvm_libs_dir']
+        paths = [getattr(self.config, pp) for pp in lib_dir_props
+                 if getattr(self.config, pp, None)]
 
-        tool_patterns = ['lld', 'ld.lld', 'lld-link', 'ld64.lld', 'wasm-ld']
+        self.with_environment('LD_LIBRARY_PATH', paths, append_path=True)
 
-        self.add_tool_substitutions(tool_patterns, tool_dirs)
+        # Discover the 'clang' and 'clangcc' to use.
+
+        ld_lld = self.use_llvm_tool('ld.lld', required=required)
+        lld_link = self.use_llvm_tool('lld-link', required=required)
+        ld64_lld = self.use_llvm_tool('ld64.lld', required=required)
+        wasm_ld = self.use_llvm_tool('wasm-ld', required=required)
+
+        was_found = ld_lld and lld_link and ld64_lld and wasm_ld
+        tool_substitutions = []
+        if ld_lld:
+            tool_substitutions.append(ToolSubst('ld.lld', command=ld_lld))
+        if lld_link:
+            tool_substitutions.append(ToolSubst('lld-link', command=lld_link))
+        if ld64_lld:
+            tool_substitutions.append(ToolSubst('ld64.lld', command=ld64_lld))
+        if wasm_ld:
+            tool_substitutions.append(ToolSubst('wasm-ld', command=wasm_ld))
+        self.add_tool_substitutions(tool_substitutions)
+        return was_found
\ No newline at end of file
Index: llvm/utils/lit/lit/TestingConfig.py
===================================================================
--- llvm/utils/lit/lit/TestingConfig.py
+++ llvm/utils/lit/lit/TestingConfig.py
@@ -85,7 +85,9 @@
         cfg_globals['config'] = self
         cfg_globals['lit_config'] = litConfig
         cfg_globals['__file__'] = path
+        original_sys_path = list(sys.path)
         try:
+            sys.path.insert(0, os.path.dirname(path))
             exec(compile(data, path, 'exec'), cfg_globals, None)
             if litConfig.debug:
                 litConfig.note('... loaded config %r' % path)
@@ -100,7 +102,7 @@
             litConfig.fatal(
                 'unable to parse config file %r, traceback: %s' % (
                     path, traceback.format_exc()))
-
+        sys.path = original_sys_path
         self.finish(litConfig)
 
     def __init__(self, parent, name, suffixes, test_format,
Index: lldb/test/CMakeLists.txt
===================================================================
--- lldb/test/CMakeLists.txt
+++ lldb/test/CMakeLists.txt
@@ -87,6 +87,12 @@
     --env ARCHIVER=${CMAKE_AR} --env OBJCOPY=${CMAKE_OBJCOPY})
 endif()
 
+if (NOT "${LLDB_LIT_TOOLS_DIR}" STREQUAL "")
+  if (NOT EXISTS "${LLDB_LIT_TOOLS_DIR}")
+    message(WARNING "LLDB_LIT_TOOLS_DIR ${LLDB_LIT_TOOLS_DIR} does not exist.")
+  endif()
+endif()
+
 if(CMAKE_HOST_APPLE)
   list(APPEND LLDB_TEST_COMMON_ARGS --server ${DEBUGSERVER_PATH})
 endif()
Index: lldb/lit/tools/lldb-mi/target/target-select-so-path.test
===================================================================
--- lldb/lit/tools/lldb-mi/target/target-select-so-path.test
+++ lldb/lit/tools/lldb-mi/target/target-select-so-path.test
@@ -1,6 +1,6 @@
 # UNSUPPORTED: windows, darwin
 #
-# RUN: %cc -o %t %p/inputs/main.c -g
+# RUN: %clang -o %t %p/inputs/main.c -g
 # RUN: %python %p/inputs/target-select-so-path.py "%debugserver" "%lldbmi %t" %s
 
 # Test that -target-select command can hook up a path
Index: lldb/lit/tools/lldb-mi/symbol/symbol-list-lines.test
===================================================================
--- lldb/lit/tools/lldb-mi/symbol/symbol-list-lines.test
+++ lldb/lit/tools/lldb-mi/symbol/symbol-list-lines.test
@@ -1,7 +1,7 @@
 # XFAIL: system-windows
 # -> llvm.org/pr24452
 #
-# RUN: %cc -o %t %p/inputs/main.c %p/inputs/symbol-list-lines.c %p/inputs/list-lines-helper.c -g
+# RUN: %clang -o %t %p/inputs/main.c %p/inputs/symbol-list-lines.c %p/inputs/list-lines-helper.c -g
 # RUN: %lldbmi %t < %s | FileCheck %s
 
 # Test lldb-mi -symbol-list-lines command.
Index: lldb/lit/tools/lldb-mi/exec/exec-step.test
===================================================================
--- lldb/lit/tools/lldb-mi/exec/exec-step.test
+++ lldb/lit/tools/lldb-mi/exec/exec-step.test
@@ -1,7 +1,7 @@
 # XFAIL: system-windows
 # -> llvm.org/pr24452
 #
-# RUN: %cc -o %t %p/inputs/main.c -g
+# RUN: %clang -o %t %p/inputs/main.c -g
 # RUN: %lldbmi %t < %s | FileCheck %s
 
 # Test lldb-mi -exec-step command.
Index: lldb/lit/tools/lldb-mi/exec/exec-step-instruction.test
===================================================================
--- lldb/lit/tools/lldb-mi/exec/exec-step-instruction.test
+++ lldb/lit/tools/lldb-mi/exec/exec-step-instruction.test
@@ -1,7 +1,7 @@
 # XFAIL: system-windows
 # -> llvm.org/pr24452
 #
-# RUN: %cc -o %t %p/inputs/main.c -g
+# RUN: %clang -o %t %p/inputs/main.c -g
 # RUN: %lldbmi %t < %s | FileCheck %s
 
 # Test lldb-mi -exec-step-instruction command.
Index: lldb/lit/tools/lldb-mi/exec/exec-next.test
===================================================================
--- lldb/lit/tools/lldb-mi/exec/exec-next.test
+++ lldb/lit/tools/lldb-mi/exec/exec-next.test
@@ -1,7 +1,7 @@
 # XFAIL: system-windows
 # -> llvm.org/pr24452
 #
-# RUN: %cc -o %t %p/inputs/main.c -g
+# RUN: %clang -o %t %p/inputs/main.c -g
 # RUN: %lldbmi %t < %s | FileCheck %s
 
 # Test lldb-mi -exec-next command.
Index: lldb/lit/tools/lldb-mi/exec/exec-next-instruction.test
===================================================================
--- lldb/lit/tools/lldb-mi/exec/exec-next-instruction.test
+++ lldb/lit/tools/lldb-mi/exec/exec-next-instruction.test
@@ -1,7 +1,7 @@
 # XFAIL: system-windows
 # -> llvm.org/pr24452
 #
-# RUN: %cc -o %t %p/inputs/main.c -g
+# RUN: %clang -o %t %p/inputs/main.c -g
 # RUN: %lldbmi %t < %s | FileCheck %s
 
 # Test lldb-mi -exec-next-instruction command.
Index: lldb/lit/tools/lldb-mi/exec/exec-interrupt.test
===================================================================
--- lldb/lit/tools/lldb-mi/exec/exec-interrupt.test
+++ lldb/lit/tools/lldb-mi/exec/exec-interrupt.test
@@ -1,7 +1,7 @@
 # XFAIL: system-windows
 # -> llvm.org/pr24452
 #
-# RUN: %cc -o %t %p/inputs/main.c -g
+# RUN: %clang -o %t %p/inputs/main.c -g
 # RUN: %lldbmi %t < %s | FileCheck %s
 
 # Test lldb-mi -exec-interrupt command.
Index: lldb/lit/tools/lldb-mi/exec/exec-finish.test
===================================================================
--- lldb/lit/tools/lldb-mi/exec/exec-finish.test
+++ lldb/lit/tools/lldb-mi/exec/exec-finish.test
@@ -1,7 +1,7 @@
 # XFAIL: system-windows
 # -> llvm.org/pr24452
 #
-# RUN: %cc -o %t %p/inputs/main.c -g
+# RUN: %clang -o %t %p/inputs/main.c -g
 # RUN: %lldbmi %t < %s | FileCheck %s
 
 # Test lldb-mi -exec-finish command.
Index: lldb/lit/tools/lldb-mi/exec/exec-continue.test
===================================================================
--- lldb/lit/tools/lldb-mi/exec/exec-continue.test
+++ lldb/lit/tools/lldb-mi/exec/exec-continue.test
@@ -1,7 +1,7 @@
 # XFAIL: system-windows
 # -> llvm.org/pr24452
 #
-# RUN: %cc -o %t %p/inputs/main.c -g
+# RUN: %clang -o %t %p/inputs/main.c -g
 # RUN: %lldbmi %t < %s | FileCheck %s
 
 # Test lldb-mi -exec-continue command.
Index: lldb/lit/tools/lldb-mi/data/data-info-line.test
===================================================================
--- lldb/lit/tools/lldb-mi/data/data-info-line.test
+++ lldb/lit/tools/lldb-mi/data/data-info-line.test
@@ -1,7 +1,7 @@
 # XFAIL: system-windows
 # -> llvm.org/pr24452
 #
-# RUN: %cc -o %t %p/inputs/data-info-line.c -g
+# RUN: %clang -o %t %p/inputs/data-info-line.c -g
 # RUN: %lldbmi %t < %s | FileCheck %s
 
 # Test lldb-mi -data-info-line command.
Index: lldb/lit/tools/lldb-mi/breakpoint/break-insert.test
===================================================================
--- lldb/lit/tools/lldb-mi/breakpoint/break-insert.test
+++ lldb/lit/tools/lldb-mi/breakpoint/break-insert.test
@@ -1,7 +1,7 @@
 # XFAIL: system-windows
 # -> llvm.org/pr24452
 #
-# RUN: %cc -o a.exe %p/inputs/break-insert.c -g
+# RUN: %clang -o a.exe %p/inputs/break-insert.c -g
 # RUN: %lldbmi < %s | FileCheck %s
 
 # Test that a breakpoint can be inserted before creating a target.
Index: lldb/lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test
===================================================================
--- lldb/lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test
+++ lldb/lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test
@@ -1,7 +1,7 @@
 # XFAIL: system-windows
 # -> llvm.org/pr24452
 #
-# RUN: %cc -o %t %p/inputs/break-insert-pending.c -g
+# RUN: %clang -o %t %p/inputs/break-insert-pending.c -g
 # RUN: %lldbmi %t < %s | FileCheck %s
 
 # Test for enabling pending breakpoints globally
Index: lldb/lit/lit.site.cfg.py.in
===================================================================
--- lldb/lit/lit.site.cfg.py.in
+++ lldb/lit/lit.site.cfg.py.in
@@ -4,26 +4,29 @@
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
 config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
+config.llvm_shlib_dir = "@SHLIBDIR@"
 config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
 config.lldb_obj_root = "@LLDB_BINARY_DIR@"
 config.lldb_libs_dir = "@LLDB_LIBS_DIR@"
 config.lldb_tools_dir = "@LLDB_TOOLS_DIR@"
+# Since it comes from the command line, it may have backslashes which
+# should not need to be escaped.
+config.lldb_lit_tools_dir = r"@LLDB_LIT_TOOLS_DIR@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.python_executable = "@PYTHON_EXECUTABLE@"
-config.cc = "@LLDB_TEST_C_COMPILER@"
-config.cxx = "@LLDB_TEST_CXX_COMPILER@"
 config.have_zlib = @LLVM_ENABLE_ZLIB@
-config.have_lld = @LLDB_HAVE_LLD@
+config.host_triple = "@LLVM_HOST_TRIPLE@"
 
 # Support substitution of the tools and libs dirs with user parameters. This is
 # used when we can't determine the tool dir at configuration time.
 try:
     config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
     config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params
+    config.llvm_shlib_dir = config.llvm_shlib_dir % lit_config.params
     config.lldb_libs_dir = config.lldb_libs_dir % lit_config.params
     config.lldb_tools_dir = config.lldb_tools_dir % lit_config.params
-    config.cc = config.cc % lit_config.params
-    config.cxx = config.cxx % lit_config.params
+    config.lldb_lit_tools_dir = config.lldb_lit_tools_dir % lit_config.params
+
 except KeyError as e:
     key, = e.args
     lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
Index: lldb/lit/lit.cfg.py
===================================================================
--- lldb/lit/lit.cfg.py
+++ lldb/lit/lit.cfg.py
@@ -1,18 +1,18 @@
 # -*- Python -*-
 
 import os
-import sys
 import re
-import platform
 import shutil
-import subprocess
+import site
+import sys
 
-import lit.util
 import lit.formats
 from lit.llvm import llvm_config
 from lit.llvm.subst import FindTool
 from lit.llvm.subst import ToolSubst
 
+from helper import toolchain
+
 # name: The name of this test suite.
 config.name = 'LLDB'
 
@@ -34,80 +34,17 @@
 # test_exec_root: The root path where tests should be run.
 config.test_exec_root = os.path.join(config.lldb_obj_root, 'lit')
 
-# Tweak the PATH to include the tools dir.
-llvm_config.with_system_environment('PATH')
-llvm_config.with_environment('PATH', config.lldb_tools_dir, append_path=True)
-llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True)
 
-llvm_config.with_environment('LD_LIBRARY_PATH', config.lldb_libs_dir, append_path=True)
-llvm_config.with_environment('LD_LIBRARY_PATH', config.llvm_libs_dir, append_path=True)
-llvm_config.with_system_environment('LD_LIBRARY_PATH', append_path=True)
+llvm_config.use_default_substitutions()
 
+toolchain.use_lldb_substitutions(config)
 
-llvm_config.use_default_substitutions()
+toolchain.use_support_substitutions(config)
 
-if platform.system() in ['Darwin']:
-    debugserver = lit.util.which('debugserver', config.lldb_tools_dir)
-else:
-    debugserver = lit.util.which('lldb-server', config.lldb_tools_dir)
-lldb = "%s -S %s/lit-lldb-init" % (lit.util.which('lldb', config.lldb_tools_dir),
-                               config.test_source_root)
-
-lldbmi = lit.util.which('lldb-mi', config.lldb_tools_dir)
-if lldbmi:
-    config.available_features.add('lldb-mi')
-
-config.cc = llvm_config.use_llvm_tool(config.cc, required=True)
-config.cxx = llvm_config.use_llvm_tool(config.cxx, required=True)
-
-if platform.system() in ['Darwin']:
-    try:
-        out = subprocess.check_output(['xcrun', '--show-sdk-path']).strip()
-        res = 0
-    except OSError:
-        res = -1
-    if res == 0 and out:
-        sdk_path = lit.util.to_string(out)
-        lit_config.note('using SDKROOT: %r' % sdk_path)
-        config.cc += " -isysroot %s" % sdk_path
-        config.cxx += " -isysroot %s" % sdk_path
-
-if platform.system() in ['OpenBSD']:
-    config.cc += " -pthread"
-    config.cxx += " -pthread"
-
-config.substitutions.append(('%cc', config.cc))
-config.substitutions.append(('%cxx', config.cxx))
-
-if lldbmi:
-  config.substitutions.append(('%lldbmi', lldbmi + " --synchronous"))
-config.substitutions.append(('%lldb', lldb))
-
-if debugserver is not None:
-    if platform.system() in ['Darwin']:
-        config.substitutions.append(('%debugserver', debugserver))
-    else:
-        config.substitutions.append(('%debugserver', debugserver + ' gdbserver'))
-
-tools = ['lldb-test', 'yaml2obj', 'obj2yaml', 'llvm-pdbutil']
-llvm_config.add_tool_substitutions(tools, [config.llvm_tools_dir, config.lldb_tools_dir])
 
 if re.match(r'^arm(hf.*-linux)|(.*-linux-gnuabihf)', config.target_triple):
     config.available_features.add("armhf-linux")
 
-print("config.cc = {}".format(config.cc))
-if re.match(r'icc', config.cc):
-    config.available_features.add("compiler-icc")
-elif re.match(r'clang', config.cc):
-    config.available_features.add("compiler-clang")
-elif re.match(r'gcc', config.cc):
-    config.available_features.add("compiler-gcc")
-elif re.match(r'cl', config.cc):
-    config.available_features.add("compiler-msvc")
-
-if config.have_lld:
-  config.available_features.add("lld")
-
 def calculate_arch_features(arch_string):
     # This will add a feature such as x86, arm, mips, etc for each built
     # target
Index: lldb/lit/helper/toolchain.py
===================================================================
--- /dev/null
+++ lldb/lit/helper/toolchain.py
@@ -0,0 +1,104 @@
+import os
+import platform
+import subprocess
+import sys
+
+import lit.util
+from lit.llvm import llvm_config
+from lit.llvm.subst import FindTool
+from lit.llvm.subst import ToolSubst
+
+def use_lldb_substitutions(config):
+    # Set up substitutions for primary tools.  These tools must come from config.lldb_tools_dir
+    # which is basically the build output directory.  We do not want to find these in path or
+    # anywhere else, since they are specifically the programs which are actually being tested.
+
+    dsname = 'debugserver' if platform.system() in ['Darwin'] else 'lldb-server'
+    dsargs = [] if platform.system() in ['Darwin'] else ['gdbserver']
+    lldbmi = ToolSubst('%lldbmi',
+                       command=FindTool('lldb-mi'),
+                       extra_args=['--synchronous'],
+                       unresolved='ignore')
+    primary_tools = [
+        ToolSubst('%lldb',
+                  command=FindTool('lldb'),
+                  extra_args=['-S',
+                              os.path.join(config.test_source_root,
+                                           'lit-lldb-init')]),
+        lldbmi,
+        ToolSubst('%debugserver',
+                  command=FindTool(dsname),
+                  extra_args=dsargs,
+                  unresolved='ignore'),
+        'lldb-test'
+        ]
+
+    llvm_config.add_tool_substitutions(primary_tools,
+                                       [config.lldb_tools_dir])
+    if lldbmi.was_resolved:
+        config.available_features.add('lldb-mi')
+
+def _use_msvc_substitutions(config):
+    # If running from a Visual Studio Command prompt (e.g. vcvars), this will
+    # detect the include and lib paths, and find cl.exe and link.exe and create
+    # substitutions for each of them that explicitly specify /I and /L paths
+    cl = '"' + lit.util.which('cl') + '"'
+    link = '"' + lit.util.which('link') + '"'
+
+    if not cl or not link:
+        return
+
+    includes = os.getenv('INCLUDE', '').split(';')
+    libs = os.getenv('LIB', '').split(';')
+
+    config.available_features.add('msvc')
+    compiler_flags = ['"/I{}"'.format(x) for x in includes if os.path.exists(x)]
+    linker_flags = ['"/LIBPATH:{}"'.format(x) for x in libs if os.path.exists(x)]
+
+    tools = [
+        ToolSubst('%msvc_cl', command=cl, extra_args=compiler_flags),
+        ToolSubst('%msvc_link', command=link, extra_args=linker_flags)]
+    llvm_config.add_tool_substitutions(tools)
+    return
+
+def use_support_substitutions(config):
+    # Set up substitutions for support tools.  These tools can be overridden at the CMake
+    # level (by specifying -DLLDB_LIT_TOOLS_DIR), installed, or as a last resort, we can use
+    # the just-built version.
+    flags = []
+    if platform.system() in ['Darwin']:
+        try:
+            out = subprocess.check_output(['xcrun', '--show-sdk-path']).strip()
+            res = 0
+        except OSError:
+            res = -1
+        if res == 0 and out:
+            sdk_path = lit.util.to_string(out)
+            lit_config.note('using SDKROOT: %r' % sdk_path)
+            flags = ['-isysroot', sdk_path]
+    elif platform.system() in ['OpenBSD']:
+        flags = ['-pthread']
+
+
+    additional_tool_dirs=[]
+    if config.lldb_lit_tools_dir:
+        additional_tool_dirs.append(config.lldb_lit_tools_dir)
+
+    llvm_config.use_clang(additional_flags=flags,
+                          additional_tool_dirs=additional_tool_dirs,
+                          required=True)
+
+    if sys.platform == 'win32':
+        _use_msvc_substitutions(config)
+
+    have_lld = llvm_config.use_lld(additional_tool_dirs=additional_tool_dirs,
+                                   required=False)
+    if have_lld:
+        config.available_features.add('lld')
+
+
+    support_tools = ['yaml2obj', 'obj2yaml', 'llvm-pdbutil',
+                     'llvm-mc', 'llvm-readobj', 'llvm-objdump',
+                     'llvm-objcopy']
+    additional_tool_dirs += [config.lldb_tools_dir, config.llvm_tools_dir]
+    llvm_config.add_tool_substitutions(support_tools, additional_tool_dirs)
Index: lldb/lit/SymbolFile/PDB/vbases.test
===================================================================
--- lldb/lit/SymbolFile/PDB/vbases.test
+++ lldb/lit/SymbolFile/PDB/vbases.test
@@ -1,5 +1,6 @@
-REQUIRES: system-windows
-RUN: clang-cl /Zi %S/Inputs/VBases.cpp /o %t.exe
+REQUIRES: system-windows, msvc
+RUN: %clang_cl /Zi %S/Inputs/VBases.cpp /c /o %t.obj
+RUN: %msvc_link /debug:full %t.obj /out:%t.exe
 RUN: %lldb -b -s %S/Inputs/VBases.script -- %t.exe | FileCheck %s
 
 CHECK: {
Index: lldb/lit/SymbolFile/PDB/variables.test
===================================================================
--- lldb/lit/SymbolFile/PDB/variables.test
+++ lldb/lit/SymbolFile/PDB/variables.test
@@ -1,6 +1,6 @@
-REQUIRES: system-windows
-RUN: clang-cl -m64 /Z7 /c /GS- %S/Inputs/VariablesTest.cpp /o %T/VariablesTest.cpp.obj
-RUN: link %T/VariablesTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/VariablesTest.cpp.exe
+REQUIRES: system-windows, msvc
+RUN: %clang_cl -m64 /Z7 /c /GS- %S/Inputs/VariablesTest.cpp /o %T/VariablesTest.cpp.obj
+RUN: %msvc_link %T/VariablesTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/VariablesTest.cpp.exe
 RUN: lldb-test symbols %T/VariablesTest.cpp.exe | FileCheck %s
 
 CHECK: Module [[MOD:.*]]
Index: lldb/lit/SymbolFile/PDB/variables-locations.test
===================================================================
--- lldb/lit/SymbolFile/PDB/variables-locations.test
+++ lldb/lit/SymbolFile/PDB/variables-locations.test
@@ -1,5 +1,6 @@
-REQUIRES: system-windows
-RUN: clang-cl /Zi %S/Inputs/VariablesLocationsTest.cpp /o %t.exe
+REQUIRES: system-windows, msvc
+RUN: %clang_cl /Zi %S/Inputs/VariablesLocationsTest.cpp /c /o %t.obj
+RUN: %msvc_link /debug:full %t.obj /out:%t.exe
 RUN: %lldb -b -s %S/Inputs/VariablesLocationsTest.script -- %t.exe | FileCheck %s
 
 CHECK: g_var = 2222
Index: lldb/lit/SymbolFile/PDB/udt-layout.test
===================================================================
--- lldb/lit/SymbolFile/PDB/udt-layout.test
+++ lldb/lit/SymbolFile/PDB/udt-layout.test
@@ -1,5 +1,6 @@
-REQUIRES: system-windows
-RUN: clang-cl /Zi %S/Inputs/UdtLayoutTest.cpp /o %t.exe
+REQUIRES: system-windows, msvc
+RUN: %clang_cl /Zi %S/Inputs/UdtLayoutTest.cpp /c /o %t.obj
+RUN: %msvc_link /DEBUG:FULL /out:%t.exe %t.obj 
 RUN: %lldb -b -s %S/Inputs/UdtLayoutTest.script -- %t.exe | FileCheck %s
 
 CHECK:(int) int C::abc = 123
Index: lldb/lit/SymbolFile/PDB/typedefs.test
===================================================================
--- lldb/lit/SymbolFile/PDB/typedefs.test
+++ lldb/lit/SymbolFile/PDB/typedefs.test
@@ -1,6 +1,6 @@
-REQUIRES: system-windows
-RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/SimpleTypesTest.cpp /o %T/SimpleTypesTest.cpp.typedefs.obj
-RUN: link %T/SimpleTypesTest.cpp.typedefs.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/SimpleTypesTest.cpp.typedefs.exe
+REQUIRES: system-windows, msvc
+RUN: %clang_cl -m32 /Z7 /c /GS- %S/Inputs/SimpleTypesTest.cpp /o %T/SimpleTypesTest.cpp.typedefs.obj
+RUN: %msvc_link %T/SimpleTypesTest.cpp.typedefs.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/SimpleTypesTest.cpp.typedefs.exe
 RUN: lldb-test symbols %T/SimpleTypesTest.cpp.typedefs.exe | FileCheck %s
 
 ; Generate 32-bit target
Index: lldb/lit/SymbolFile/PDB/type-quals.test
===================================================================
--- lldb/lit/SymbolFile/PDB/type-quals.test
+++ lldb/lit/SymbolFile/PDB/type-quals.test
@@ -1,6 +1,6 @@
-REQUIRES: system-windows
-RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/TypeQualsTest.cpp /o %T/TypeQualsTest.cpp.obj
-RUN: link %T/TypeQualsTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/TypeQualsTest.cpp.exe
+REQUIRES: system-windows, msvc
+RUN: %clang_cl -m32 /Z7 /c /GS- %S/Inputs/TypeQualsTest.cpp /o %T/TypeQualsTest.cpp.obj
+RUN: %msvc_link %T/TypeQualsTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/TypeQualsTest.cpp.exe
 RUN: lldb-test symbols %T/TypeQualsTest.cpp.exe | FileCheck %s
 
 CHECK: Module [[MOD:.*]]
Index: lldb/lit/SymbolFile/PDB/pointers.test
===================================================================
--- lldb/lit/SymbolFile/PDB/pointers.test
+++ lldb/lit/SymbolFile/PDB/pointers.test
@@ -1,6 +1,6 @@
-REQUIRES: system-windows
-RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/PointerTypeTest.cpp /o %T/PointerTypeTest.cpp.obj
-RUN: link %T/PointerTypeTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/PointerTypeTest.cpp.exe
+REQUIRES: system-windows, msvc
+RUN: %clang_cl -m32 /Z7 /c /GS- %S/Inputs/PointerTypeTest.cpp /o %T/PointerTypeTest.cpp.obj
+RUN: %msvc_link %T/PointerTypeTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/PointerTypeTest.cpp.exe
 RUN: lldb-test symbols %T/PointerTypeTest.cpp.exe | FileCheck %s
 RUN: lldb-test symbols %T/PointerTypeTest.cpp.exe | FileCheck --check-prefix=MAIN-ST-F %s
 RUN: lldb-test symbols %T/PointerTypeTest.cpp.exe | FileCheck --check-prefix=MAIN-ST %s
Index: lldb/lit/SymbolFile/PDB/function-nested-block.test
===================================================================
--- lldb/lit/SymbolFile/PDB/function-nested-block.test
+++ lldb/lit/SymbolFile/PDB/function-nested-block.test
@@ -1,5 +1,5 @@
 REQUIRES: system-windows, lld
-RUN: clang-cl /c /Zi %S/Inputs/FunctionNestedBlockTest.cpp /o %t.obj
+RUN: %clang_cl /c /Zi %S/Inputs/FunctionNestedBlockTest.cpp /o %t.obj
 RUN: lld-link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe
 RUN: lldb-test symbols -find=function -file FunctionNestedBlockTest.cpp -line 4 %t.exe | FileCheck --check-prefix=CHECK-FUNCTION %s
 RUN: lldb-test symbols -find=block -file FunctionNestedBlockTest.cpp -line 4 %t.exe | FileCheck --check-prefix=CHECK-BLOCK %s
Index: lldb/lit/SymbolFile/PDB/function-level-linking.test
===================================================================
--- lldb/lit/SymbolFile/PDB/function-level-linking.test
+++ lldb/lit/SymbolFile/PDB/function-level-linking.test
@@ -1,4 +1,4 @@
 REQUIRES: system-windows, lld
-RUN: clang-cl /c /Zi /Gy %S/Inputs/FunctionLevelLinkingTest.cpp /o %t.obj
+RUN: %clang_cl /c /Zi /Gy %S/Inputs/FunctionLevelLinkingTest.cpp /o %t.obj
 RUN: lld-link /debug:full /nodefaultlib /entry:main /order:@%S/Inputs/FunctionLevelLinkingTest.ord %t.obj /out:%t.exe
 RUN: lldb-test symbols -verify %t.exe
Index: lldb/lit/SymbolFile/PDB/func-symbols.test
===================================================================
--- lldb/lit/SymbolFile/PDB/func-symbols.test
+++ lldb/lit/SymbolFile/PDB/func-symbols.test
@@ -1,7 +1,7 @@
-REQUIRES: system-windows
-RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/FuncSymbolsTestMain.cpp /o %T/FuncSymbolsTestMain.cpp.obj
-RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/FuncSymbols.cpp /o %T/FuncSymbols.cpp.obj
-RUN: link %T/FuncSymbolsTestMain.cpp.obj %T/FuncSymbols.cpp.obj /DEBUG /nodefaultlib /Entry:main /OUT:%T/FuncSymbolsTest.exe
+REQUIRES: system-windows, msvc
+RUN: %clang_cl -m32 /Z7 /c /GS- %S/Inputs/FuncSymbolsTestMain.cpp /o %T/FuncSymbolsTestMain.cpp.obj
+RUN: %clang_cl -m32 /Z7 /c /GS- %S/Inputs/FuncSymbols.cpp /o %T/FuncSymbols.cpp.obj
+RUN: %msvc_link %T/FuncSymbolsTestMain.cpp.obj %T/FuncSymbols.cpp.obj /DEBUG /nodefaultlib /Entry:main /OUT:%T/FuncSymbolsTest.exe
 RUN: lldb-test symbols %T/FuncSymbolsTest.exe | FileCheck --check-prefix=CHECK-ONE %s
 RUN: lldb-test symbols %T/FuncSymbolsTest.exe | FileCheck --check-prefix=CHECK-TWO %s
 
Index: lldb/lit/SymbolFile/PDB/enums-layout.test
===================================================================
--- lldb/lit/SymbolFile/PDB/enums-layout.test
+++ lldb/lit/SymbolFile/PDB/enums-layout.test
@@ -1,6 +1,6 @@
-REQUIRES: system-windows
-RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/SimpleTypesTest.cpp /o %T/SimpleTypesTest.cpp.enums.obj
-RUN: link %T/SimpleTypesTest.cpp.enums.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/SimpleTypesTest.cpp.enums.exe
+REQUIRES: system-windows, msvc
+RUN: %clang_cl -m32 /Z7 /c /GS- %S/Inputs/SimpleTypesTest.cpp /o %T/SimpleTypesTest.cpp.enums.obj
+RUN: %msvc_link %T/SimpleTypesTest.cpp.enums.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/SimpleTypesTest.cpp.enums.exe
 RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck %s
 
 ; FIXME: PDB does not have information about scoped enumeration (Enum class) so the  
Index: lldb/lit/SymbolFile/PDB/compilands.test
===================================================================
--- lldb/lit/SymbolFile/PDB/compilands.test
+++ lldb/lit/SymbolFile/PDB/compilands.test
@@ -1,5 +1,6 @@
-REQUIRES: system-windows
-RUN: clang-cl /Z7 %S/Inputs/CompilandsTest.cpp /o %T/CompilandsTest.cpp.exe
+REQUIRES: system-windows, msvc
+RUN: %clang_cl /Z7 /c %S/Inputs/CompilandsTest.cpp /o %T/CompilandsTest.cpp.obj
+RUN: %msvc_link /debug:full /nodefaultlib /entry:main %T/CompilandsTest.cpp.obj /out:%T/CompilandsTest.cpp.exe
 RUN: lldb-test symbols %T/CompilandsTest.cpp.exe | FileCheck %s
 
 ; Link default libraries
Index: lldb/lit/SymbolFile/PDB/class-layout.test
===================================================================
--- lldb/lit/SymbolFile/PDB/class-layout.test
+++ lldb/lit/SymbolFile/PDB/class-layout.test
@@ -1,6 +1,6 @@
-REQUIRES: system-windows
-RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/ClassLayoutTest.cpp /o %T/ClassLayoutTest.cpp.obj
-RUN: link %T/ClassLayoutTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/ClassLayoutTest.cpp.exe
+REQUIRES: msvc
+RUN: %clang_cl -m32 /Z7 /c /GS- %S/Inputs/ClassLayoutTest.cpp /o %T/ClassLayoutTest.cpp.obj
+RUN: %msvc_link %T/ClassLayoutTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/ClassLayoutTest.cpp.exe
 RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck %s
 RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=ENUM %s
 RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=UNION %s
Index: lldb/lit/SymbolFile/PDB/calling-conventions.test
===================================================================
--- lldb/lit/SymbolFile/PDB/calling-conventions.test
+++ lldb/lit/SymbolFile/PDB/calling-conventions.test
@@ -1,5 +1,5 @@
 REQUIRES: system-windows, lld
-RUN: clang-cl -m32 /Zi /GS- /c %S/Inputs/CallingConventionsTest.cpp /o %t.obj
+RUN: %clang_cl -m32 /Zi /GS- /c %S/Inputs/CallingConventionsTest.cpp /o %t.obj
 RUN: lld-link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe
 RUN: lldb-test symbols -dump-ast %t.exe | FileCheck %s
 
Index: lldb/lit/SymbolFile/PDB/ast-restore.test
===================================================================
--- lldb/lit/SymbolFile/PDB/ast-restore.test
+++ lldb/lit/SymbolFile/PDB/ast-restore.test
@@ -1,6 +1,6 @@
 REQUIRES: system-windows
-RUN: cl /Zi /GS- /c %S/Inputs/AstRestoreTest.cpp /Fo%t.obj
-RUN: link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe
+RUN: %msvc_cl /Zi /GS- /c %S/Inputs/AstRestoreTest.cpp /Fo%t.obj
+RUN: %msvc_link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe
 RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=ENUM %s
 RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=GLOBAL %s
 RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=BASE %s
Index: lldb/lit/SymbolFile/NativePDB/tag-types.cpp
===================================================================
--- lldb/lit/SymbolFile/NativePDB/tag-types.cpp
+++ lldb/lit/SymbolFile/NativePDB/tag-types.cpp
@@ -2,9 +2,9 @@
 // REQUIRES: lld
 
 // Test that we can display tag types.
-// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s 
+// RUN: %clang_cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s 
 // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN:     %p/Inputs/tag-types.lldbinit | FileCheck %s
 
 // Test struct
Index: lldb/lit/SymbolFile/NativePDB/source-list.cpp
===================================================================
--- lldb/lit/SymbolFile/NativePDB/source-list.cpp
+++ lldb/lit/SymbolFile/NativePDB/source-list.cpp
@@ -2,9 +2,9 @@
 // REQUIRES: lld
 
 // Test that we can set display source of functions.
-// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s 
+// RUN: %clang_cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s 
 // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN:     %p/Inputs/source-list.lldbinit | FileCheck %s
 
 
Index: lldb/lit/SymbolFile/NativePDB/simple-breakpoints.cpp
===================================================================
--- lldb/lit/SymbolFile/NativePDB/simple-breakpoints.cpp
+++ lldb/lit/SymbolFile/NativePDB/simple-breakpoints.cpp
@@ -2,9 +2,9 @@
 // REQUIRES: lld
 
 // Test that we can set simple breakpoints using PDB on any platform.
-// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s 
+// RUN: %clang_cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s 
 // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN:     %p/Inputs/breakpoints.lldbinit | FileCheck %s
 
 // Use different indentation style for each overload so that the starting
Index: lldb/lit/SymbolFile/NativePDB/s_constant.cpp
===================================================================
--- lldb/lit/SymbolFile/NativePDB/s_constant.cpp
+++ lldb/lit/SymbolFile/NativePDB/s_constant.cpp
@@ -5,7 +5,7 @@
 
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-win32 %p/Inputs/s_constant.s > %t.obj
 // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN:     %p/Inputs/s_constant.lldbinit | FileCheck %s
 
 // clang-cl cannot generate S_CONSTANT records, but we need to test that we can
Index: lldb/lit/SymbolFile/NativePDB/nested-types.cpp
===================================================================
--- lldb/lit/SymbolFile/NativePDB/nested-types.cpp
+++ lldb/lit/SymbolFile/NativePDB/nested-types.cpp
@@ -2,9 +2,9 @@
 // REQUIRES: lld
 
 // Test various interesting cases for AST reconstruction.
-// RUN: clang-cl /Z7 /GS- /GR- -Xclang -fkeep-static-consts /c /Fo%t.obj -- %s
+// RUN: %clang_cl /Z7 /GS- /GR- -Xclang -fkeep-static-consts /c /Fo%t.obj -- %s
 // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN:     %p/Inputs/nested-types.lldbinit 2>&1 | FileCheck %s
 
 struct S {
Index: lldb/lit/SymbolFile/NativePDB/globals-fundamental.cpp
===================================================================
--- lldb/lit/SymbolFile/NativePDB/globals-fundamental.cpp
+++ lldb/lit/SymbolFile/NativePDB/globals-fundamental.cpp
@@ -2,9 +2,9 @@
 // REQUIRES: lld
 
 // Test that we can display tag types.
-// RUN: clang-cl /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s
+// RUN: %clang_cl /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s
 // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN:     %p/Inputs/globals-fundamental.lldbinit | FileCheck %s
 
 
Index: lldb/lit/SymbolFile/NativePDB/globals-bss.cpp
===================================================================
--- lldb/lit/SymbolFile/NativePDB/globals-bss.cpp
+++ lldb/lit/SymbolFile/NativePDB/globals-bss.cpp
@@ -2,10 +2,10 @@
 // REQUIRES: lld
 
 // Make sure we can read variables from BSS
-// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s
+// RUN: %clang_cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s
 // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
 // RUN: llvm-readobj -s %t.exe | FileCheck --check-prefix=BSS %s
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN:     %p/Inputs/globals-bss.lldbinit 2>&1 | FileCheck %s
 
 int GlobalVariable = 0;
Index: lldb/lit/SymbolFile/NativePDB/global-classes.cpp
===================================================================
--- lldb/lit/SymbolFile/NativePDB/global-classes.cpp
+++ lldb/lit/SymbolFile/NativePDB/global-classes.cpp
@@ -2,9 +2,9 @@
 // REQUIRES: lld
 
 // Test that we can display tag types.
-// RUN: clang-cl /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s
+// RUN: %clang_cl /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s
 // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN:     %p/Inputs/globals-classes.lldbinit | FileCheck %s
 
 enum class EnumType : unsigned {
Index: lldb/lit/SymbolFile/NativePDB/function-types-classes.cpp
===================================================================
--- lldb/lit/SymbolFile/NativePDB/function-types-classes.cpp
+++ lldb/lit/SymbolFile/NativePDB/function-types-classes.cpp
@@ -2,9 +2,9 @@
 // REQUIRES: lld
 
 // Test that we can display function signatures with class types.
-// RUN: clang-cl /Z7 /GS- /GR- /c -fstandalone-debug -Xclang -fkeep-static-consts /Fo%t.obj -- %s
+// RUN: %clang_cl /Z7 /GS- /GR- /c -fstandalone-debug -Xclang -fkeep-static-consts /Fo%t.obj -- %s
 // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN:     %p/Inputs/function-types-classes.lldbinit | FileCheck %s
 
 // This is just some unimportant helpers needed so that we can get reference and
Index: lldb/lit/SymbolFile/NativePDB/function-types-calling-conv.cpp
===================================================================
--- lldb/lit/SymbolFile/NativePDB/function-types-calling-conv.cpp
+++ lldb/lit/SymbolFile/NativePDB/function-types-calling-conv.cpp
@@ -1,9 +1,9 @@
 // clang-format off
 // REQUIRES: lld
 
-// RUN: clang-cl -m32 /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s
+// RUN: %clang_cl -m32 /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s
 // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN:     %p/Inputs/function-types-calling-conv.lldbinit | FileCheck %s
 
 
Index: lldb/lit/SymbolFile/NativePDB/function-types-builtins.cpp
===================================================================
--- lldb/lit/SymbolFile/NativePDB/function-types-builtins.cpp
+++ lldb/lit/SymbolFile/NativePDB/function-types-builtins.cpp
@@ -1,9 +1,9 @@
 // clang-format off
 // REQUIRES: lld
 
-// RUN: clang-cl /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s
+// RUN: %clang_cl /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s
 // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN:     %p/Inputs/function-types-builtins.lldbinit | FileCheck %s
 
 // Test that we can display function signatures with simple builtin
Index: lldb/lit/SymbolFile/NativePDB/disassembly.cpp
===================================================================
--- lldb/lit/SymbolFile/NativePDB/disassembly.cpp
+++ lldb/lit/SymbolFile/NativePDB/disassembly.cpp
@@ -2,9 +2,9 @@
 // REQUIRES: lld
 
 // Test that we can show disassembly and source.
-// RUN: clang-cl -m64 /Z7 /GS- /GR- /c /Fo%t.obj -- %s
+// RUN: %clang_cl -m64 /Z7 /GS- /GR- /c /Fo%t.obj -- %s
 // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN:     %p/Inputs/disassembly.lldbinit | FileCheck %s
 
 // Some context lines before
Index: lldb/lit/SymbolFile/NativePDB/bitfields.cpp
===================================================================
--- lldb/lit/SymbolFile/NativePDB/bitfields.cpp
+++ lldb/lit/SymbolFile/NativePDB/bitfields.cpp
@@ -2,9 +2,9 @@
 // REQUIRES: lld
 
 // Test various interesting cases for AST reconstruction.
-// RUN: clang-cl /Z7 /GS- /GR- /std:c++latest -Xclang -fkeep-static-consts /c /Fo%t.obj -- %s
+// RUN: %clang_cl /Z7 /GS- /GR- /std:c++latest -Xclang -fkeep-static-consts /c /Fo%t.obj -- %s
 // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN:     %p/Inputs/bitfields.lldbinit 2>&1 | FileCheck %s
 
 // Test trivial versions of each tag type.
Index: lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
===================================================================
--- lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
+++ lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
@@ -2,9 +2,9 @@
 // REQUIRES: lld
 
 // Test various interesting cases for AST reconstruction.
-// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s
+// RUN: %clang_cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s
 // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN:     %p/Inputs/ast-reconstruction.lldbinit 2>&1 | FileCheck %s
 
 // Test trivial versions of each tag type.
Index: lldb/lit/SymbolFile/DWARF/find-variable-file.cpp
===================================================================
--- lldb/lit/SymbolFile/DWARF/find-variable-file.cpp
+++ lldb/lit/SymbolFile/DWARF/find-variable-file.cpp
@@ -1,15 +1,15 @@
 // REQUIRES: lld
 
-// RUN: clang -g -c -o %t-1.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable %s
-// RUN: clang -g -c -o %t-2.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable %S/Inputs/find-variable-file-2.cpp
+// RUN: %clang -g -c -o %t-1.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable %s
+// RUN: %clang -g -c -o %t-2.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable %S/Inputs/find-variable-file-2.cpp
 // RUN: ld.lld %t-1.o %t-2.o -o %t
 // RUN: lldb-test symbols --file=find-variable-file.cpp --find=variable %t | \
 // RUN:   FileCheck --check-prefix=ONE %s
 // RUN: lldb-test symbols --file=find-variable-file-2.cpp --find=variable %t | \
 // RUN:   FileCheck --check-prefix=TWO %s
 
-// RUN: clang -g -c -o %t-1.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %s
-// RUN: clang -g -c -o %t-2.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %S/Inputs/find-variable-file-2.cpp
+// RUN: %clang -g -c -o %t-1.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %s
+// RUN: %clang -g -c -o %t-2.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %S/Inputs/find-variable-file-2.cpp
 // RUN: ld.lld %t-1.o %t-2.o -o %t
 // RUN: lldb-test symbols --file=find-variable-file.cpp --find=variable %t | \
 // RUN:   FileCheck --check-prefix=ONE %s
Index: lldb/lit/SymbolFile/DWARF/find-variable-dwo.cpp
===================================================================
--- lldb/lit/SymbolFile/DWARF/find-variable-dwo.cpp
+++ lldb/lit/SymbolFile/DWARF/find-variable-dwo.cpp
@@ -1,9 +1,9 @@
 // REQUIRES: lld
 
-// RUN: clang %s -g -gsplit-dwarf -c -emit-llvm -o - --target=x86_64-pc-linux -DONE | \
+// RUN: %clang %s -g -gsplit-dwarf -c -emit-llvm -o - --target=x86_64-pc-linux -DONE | \
 // RUN:   llc -accel-tables=Dwarf -filetype=obj -split-dwarf-file=%t-1.dwo -o %t-1.o
 // RUN: llvm-objcopy --split-dwo=%t-1.dwo %t-1.o
-// RUN: clang %s -g -gsplit-dwarf -c -emit-llvm -o - --target=x86_64-pc-linux -DTWO | \
+// RUN: %clang %s -g -gsplit-dwarf -c -emit-llvm -o - --target=x86_64-pc-linux -DTWO | \
 // RUN:   llc -accel-tables=Dwarf -filetype=obj -split-dwarf-file=%t-2.dwo -o %t-2.o
 // RUN: llvm-objcopy --split-dwo=%t-2.dwo %t-2.o
 // RUN: ld.lld %t-1.o %t-2.o -o %t
Index: lldb/lit/SymbolFile/DWARF/find-type-in-function.cpp
===================================================================
--- lldb/lit/SymbolFile/DWARF/find-type-in-function.cpp
+++ lldb/lit/SymbolFile/DWARF/find-type-in-function.cpp
@@ -2,7 +2,7 @@
 
 // XFAIL: *
 
-// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux
+// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux
 // RUN: ld.lld %t.o -o %t
 // RUN: lldb-test symbols --name=foo --find=type %t | \
 // RUN:   FileCheck --check-prefix=NAME %s
Index: lldb/lit/SymbolFile/DWARF/find-qualified-variable.cpp
===================================================================
--- lldb/lit/SymbolFile/DWARF/find-qualified-variable.cpp
+++ lldb/lit/SymbolFile/DWARF/find-qualified-variable.cpp
@@ -1,4 +1,4 @@
-// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
+// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx
 // RUN: lldb-test symbols --name=A::foo --find=variable %t | FileCheck %s
 
 // CHECK: Found 1 variables:
Index: lldb/lit/SymbolFile/DWARF/find-method.cpp
===================================================================
--- lldb/lit/SymbolFile/DWARF/find-method.cpp
+++ lldb/lit/SymbolFile/DWARF/find-method.cpp
@@ -1,11 +1,11 @@
 // REQUIRES: lld
 
-// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable
+// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable
 // RUN: ld.lld %t.o -o %t
 // RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \
 // RUN:   FileCheck %s
 //
-// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
+// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx
 // RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \
 // RUN:   FileCheck %s
 
Index: lldb/lit/SymbolFile/DWARF/find-method-local-struct.cpp
===================================================================
--- lldb/lit/SymbolFile/DWARF/find-method-local-struct.cpp
+++ lldb/lit/SymbolFile/DWARF/find-method-local-struct.cpp
@@ -1,4 +1,4 @@
-// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
+// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx
 // RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \
 // RUN:   FileCheck %s
 
Index: lldb/lit/SymbolFile/DWARF/find-function-regex.cpp
===================================================================
--- lldb/lit/SymbolFile/DWARF/find-function-regex.cpp
+++ lldb/lit/SymbolFile/DWARF/find-function-regex.cpp
@@ -1,13 +1,13 @@
 // REQUIRES: lld
 
-// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable
+// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable
 // RUN: ld.lld %t.o -o %t
 // RUN: lldb-test symbols --name=f.o --regex --find=function %t | FileCheck %s
 //
-// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
+// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx
 // RUN: lldb-test symbols --name=f.o --regex --find=function %t | FileCheck %s
 
-// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf
+// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf
 // RUN: ld.lld %t.o -o %t
 // RUN: lldb-test symbols --name=f.o --regex --find=function %t | FileCheck %s
 
Index: lldb/lit/SymbolFile/DWARF/find-basic-variable.cpp
===================================================================
--- lldb/lit/SymbolFile/DWARF/find-basic-variable.cpp
+++ lldb/lit/SymbolFile/DWARF/find-basic-variable.cpp
@@ -1,6 +1,6 @@
 // REQUIRES: lld
 
-// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable
+// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable
 // RUN: ld.lld %t.o -o %t
 // RUN: lldb-test symbols --name=foo --find=variable --context=context %t | \
 // RUN:   FileCheck --check-prefix=CONTEXT %s
@@ -11,7 +11,7 @@
 // RUN: lldb-test symbols --name=not_there --find=variable %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
 //
-// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
+// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx
 // RUN: lldb-test symbols --name=foo --find=variable --context=context %t | \
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=foo --find=variable %t | \
@@ -21,7 +21,7 @@
 // RUN: lldb-test symbols --name=not_there --find=variable %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
 //
-// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf
+// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf
 // RUN: ld.lld %t.o -o %t
 // RUN: lldb-test symbols --name=foo --find=variable --context=context %t | \
 // RUN:   FileCheck --check-prefix=CONTEXT %s
Index: lldb/lit/SymbolFile/DWARF/find-basic-type.cpp
===================================================================
--- lldb/lit/SymbolFile/DWARF/find-basic-type.cpp
+++ lldb/lit/SymbolFile/DWARF/find-basic-type.cpp
@@ -1,23 +1,23 @@
 // REQUIRES: lld
 
-// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable
+// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable
 // RUN: ld.lld %t.o -o %t
 // RUN: lldb-test symbols --name=foo --find=type %t | \
 // RUN:   FileCheck --check-prefix=NAME %s
 // RUN: lldb-test symbols --name=foo --context=context --find=type %t | \
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=type %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
 //
-// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
+// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx
 // RUN: lldb-test symbols --name=foo --find=type %t | \
 // RUN:   FileCheck --check-prefix=NAME %s
 // RUN: lldb-test symbols --name=foo --context=context --find=type %t | \
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=type %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
 
-// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf
+// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf
 // RUN: ld.lld %t.o -o %t
 // RUN: lldb-test symbols --name=foo --find=type %t | \
 // RUN:   FileCheck --check-prefix=NAME %s
Index: lldb/lit/SymbolFile/DWARF/find-basic-namespace.cpp
===================================================================
--- lldb/lit/SymbolFile/DWARF/find-basic-namespace.cpp
+++ lldb/lit/SymbolFile/DWARF/find-basic-namespace.cpp
@@ -1,23 +1,23 @@
 // REQUIRES: lld
 
-// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable
+// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable
 // RUN: ld.lld %t.o -o %t
 // RUN: lldb-test symbols --name=foo --find=namespace %t | \
 // RUN:   FileCheck --check-prefix=FOO %s
 // RUN: lldb-test symbols --name=foo --find=namespace --context=context %t | \
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=namespace %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
 //
-// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
+// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx
 // RUN: lldb-test symbols --name=foo --find=namespace %t | \
 // RUN:   FileCheck --check-prefix=FOO %s
 // RUN: lldb-test symbols --name=foo --find=namespace --context=context %t | \
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=namespace %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
 
-// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf
+// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf
 // RUN: ld.lld %t.o -o %t
 // RUN: lldb-test symbols --name=foo --find=namespace %t | \
 // RUN:   FileCheck --check-prefix=FOO %s
Index: lldb/lit/SymbolFile/DWARF/find-basic-function.cpp
===================================================================
--- lldb/lit/SymbolFile/DWARF/find-basic-function.cpp
+++ lldb/lit/SymbolFile/DWARF/find-basic-function.cpp
@@ -1,6 +1,6 @@
 // REQUIRES: lld
 
-// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable
+// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable
 // RUN: ld.lld %t.o -o %t
 // RUN: lldb-test symbols --name=foo --find=function --function-flags=base %t | \
 // RUN:   FileCheck --check-prefix=BASE %s
@@ -15,7 +15,7 @@
 // RUN: lldb-test symbols --name=not_there --find=function %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
 //
-// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
+// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx
 // RUN: lldb-test symbols --name=foo --find=function --function-flags=base %t | \
 // RUN:   FileCheck --check-prefix=BASE %s
 // RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \
@@ -29,7 +29,7 @@
 // RUN: lldb-test symbols --name=not_there --find=function %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
 
-// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf
+// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf
 // RUN: ld.lld %t.o -o %t
 // RUN: lldb-test symbols --name=foo --find=function --function-flags=base %t | \
 // RUN:   FileCheck --check-prefix=BASE %s
Index: lldb/lit/SymbolFile/DWARF/dwarf5-partial-index.cpp
===================================================================
--- lldb/lit/SymbolFile/DWARF/dwarf5-partial-index.cpp
+++ lldb/lit/SymbolFile/DWARF/dwarf5-partial-index.cpp
@@ -3,8 +3,8 @@
 
 // REQUIRES: lld
 
-// RUN: clang %s -g -c -o %t-1.o --target=x86_64-pc-linux -DONE -mllvm -accel-tables=Dwarf
-// RUN: clang %s -g -c -o %t-2.o --target=x86_64-pc-linux -DTWO -mllvm -accel-tables=Dwarf
+// RUN: %clang %s -g -c -o %t-1.o --target=x86_64-pc-linux -DONE -mllvm -accel-tables=Dwarf
+// RUN: %clang %s -g -c -o %t-2.o --target=x86_64-pc-linux -DTWO -mllvm -accel-tables=Dwarf
 // RUN: ld.lld %t-1.o %t-2.o -o %t
 // RUN: lldb-test symbols --find=variable --name=foo  %t | FileCheck %s
 
Index: lldb/lit/SymbolFile/DWARF/dwarf5-index-is-used.cpp
===================================================================
--- lldb/lit/SymbolFile/DWARF/dwarf5-index-is-used.cpp
+++ lldb/lit/SymbolFile/DWARF/dwarf5-index-is-used.cpp
@@ -2,7 +2,7 @@
 
 // REQUIRES: lld
 
-// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf -gpubnames
+// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf -gpubnames
 // RUN: ld.lld %t.o -o %t
 // RUN: lldb-test symbols %t | FileCheck %s
 
Index: lldb/lit/SymbolFile/DWARF/debug-names-compressed.cpp
===================================================================
--- lldb/lit/SymbolFile/DWARF/debug-names-compressed.cpp
+++ lldb/lit/SymbolFile/DWARF/debug-names-compressed.cpp
@@ -3,7 +3,7 @@
 
 // REQUIRES: lld, zlib
 
-// RUN: clang -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %s
+// RUN: %clang -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %s
 // RUN: ld.lld %t.o -o %t --compress-debug-sections=zlib
 // RUN: lldb-test symbols --find=variable --name=foo %t | FileCheck %s
 
Index: lldb/lit/SymbolFile/DWARF/apple-index-is-used.cpp
===================================================================
--- lldb/lit/SymbolFile/DWARF/apple-index-is-used.cpp
+++ lldb/lit/SymbolFile/DWARF/apple-index-is-used.cpp
@@ -1,5 +1,5 @@
 // Test that we use the apple indexes.
-// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx
+// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx
 // RUN: lldb-test symbols %t | FileCheck %s
 
 // CHECK: .apple_names index present
Index: lldb/lit/Quit/TestQuitExitCodeHexA.test
===================================================================
--- lldb/lit/Quit/TestQuitExitCodeHexA.test
+++ lldb/lit/Quit/TestQuitExitCodeHexA.test
@@ -1,3 +1,3 @@
 # UNSUPPORTED: windows
-# RUN: python %S/expect_exit_code.py 10 %lldb -b -s %s
+# RUN: %python %S/expect_exit_code.py 10 %lldb -b -s %s
 q 0xA
Index: lldb/lit/Quit/TestQuitExitCode30.test
===================================================================
--- lldb/lit/Quit/TestQuitExitCode30.test
+++ lldb/lit/Quit/TestQuitExitCode30.test
@@ -1,3 +1,3 @@
 # UNSUPPORTED: windows
-# RUN: python %S/expect_exit_code.py 30  %lldb -b -s %s
+# RUN: %python %S/expect_exit_code.py 30  %lldb -b -s %s
 q 30
Index: lldb/lit/Quit/TestQuitExitCode-30.test
===================================================================
--- lldb/lit/Quit/TestQuitExitCode-30.test
+++ lldb/lit/Quit/TestQuitExitCode-30.test
@@ -1,3 +1,3 @@
 # UNSUPPORTED: windows
-# RUN: python %S/expect_exit_code.py 226 %lldb -b -s %s
+# RUN: %python %S/expect_exit_code.py 226 %lldb -b -s %s
 q -30
Index: lldb/lit/Expr/TestIRMemoryMapWindows.test
===================================================================
--- lldb/lit/Expr/TestIRMemoryMapWindows.test
+++ lldb/lit/Expr/TestIRMemoryMapWindows.test
@@ -1,6 +1,6 @@
 # REQUIRES: system-windows
 
-# RUN: clang-cl /Zi %p/Inputs/call-function.cpp -o %t
+# RUN: %clang_cl /Zi %p/Inputs/call-function.cpp -o %t
 
 # RUN: lldb-test ir-memory-map %t %S/Inputs/ir-memory-map-basic
 # RUN: lldb-test ir-memory-map -host-only %t %S/Inputs/ir-memory-map-basic
Index: lldb/lit/Expr/TestIRMemoryMap.test
===================================================================
--- lldb/lit/Expr/TestIRMemoryMap.test
+++ lldb/lit/Expr/TestIRMemoryMap.test
@@ -1,6 +1,6 @@
 # UNSUPPORTED: windows
 
-# RUN: %cxx %p/Inputs/call-function.cpp -g -o %t
+# RUN: %clangxx %p/Inputs/call-function.cpp -g -o %t
 
 # RUN: lldb-test ir-memory-map %t %S/Inputs/ir-memory-map-basic
 # RUN: lldb-test ir-memory-map -host-only %t %S/Inputs/ir-memory-map-basic
Index: lldb/lit/Breakpoint/case-sensitive.test
===================================================================
--- lldb/lit/Breakpoint/case-sensitive.test
+++ lldb/lit/Breakpoint/case-sensitive.test
@@ -1,6 +1,6 @@
 # REQUIRES: nowindows
 #
-# RUN: %cc %p/Inputs/case-sensitive.c -g -o %t
+# RUN: %clang %p/Inputs/case-sensitive.c -g -o %t
 # RUN: lldb-test breakpoints %t %s | FileCheck %s
 
 breakpoint set -f case-sensitive.c -l 3
Index: lldb/lit/Breakpoint/case-insensitive.test
===================================================================
--- lldb/lit/Breakpoint/case-insensitive.test
+++ lldb/lit/Breakpoint/case-insensitive.test
@@ -2,7 +2,7 @@
 # XFAIL: system-windows
 # -> llvm.org/pr24528
 #
-# RUN: %cc %p/Inputs/case-sensitive.c -g -o %t
+# RUN: %clang %p/Inputs/case-sensitive.c -g -o %t
 # RUN: lldb-test breakpoints %t %s | FileCheck %s
 
 breakpoint set -f case-sensitive.c -l 3
Index: clang/test/lit.cfg.py
===================================================================
--- clang/test/lit.cfg.py
+++ clang/test/lit.cfg.py
@@ -43,6 +43,10 @@
 
 llvm_config.use_clang()
 
+config.substitutions.append(
+    ('%src_include_dir', config.clang_src_dir + '/include'))
+
+
 # Propagate path to symbolizer for ASan/MSan.
 llvm_config.with_system_environment(
     ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH'])
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to