9 def getSysrootFlagsOnDarwin(config, lit_config):
10 # On Darwin, support relocatable SDKs by providing Clang with a
11 # default system root path.
12 if 'darwin' in config.target_triple:
14 out = subprocess.check_output(['xcrun', '--show-sdk-path']).strip()
20 lit_config.note('using SDKROOT: %r' % sdk_path)
21 return '-isysroot %s' % sdk_path
24 sysroot_flags = getSysrootFlagsOnDarwin(config, lit_config)
26 config.clang = os.path.realpath(lit.util.which('clang', config.clang_tools_dir)).replace('\\', '/')
28 config.name = 'Clang Perf Training'
29 config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl', '.s', '.S', '.modulemap']
31 dtrace_wrapper = '%s %s/perf-helper.py dtrace' % (config.python_exe, config.perf_helper_dir)
32 dtrace_wrapper_cc1 = '%s %s/perf-helper.py dtrace --cc1' % (config.python_exe, config.perf_helper_dir)
34 if 'darwin' in config.target_triple:
35 lit_config.note('using DTrace oneshot probe')
36 dtrace_wrapper = '%s --use-oneshot' % dtrace_wrapper
37 dtrace_wrapper_cc1 = '%s --use-oneshot' % dtrace_wrapper_cc1
39 use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL")
40 config.test_format = lit.formats.ShTest(use_lit_shell == "0")
41 config.substitutions.append( ('%clang_cpp_skip_driver', ' %s %s --driver-mode=g++ %s ' % (dtrace_wrapper_cc1, config.clang, sysroot_flags)))
42 config.substitutions.append( ('%clang_cpp', ' %s %s --driver-mode=g++ %s ' % (dtrace_wrapper, config.clang, sysroot_flags)))
43 config.substitutions.append( ('%clang_skip_driver', ' %s %s %s ' % (dtrace_wrapper_cc1, config.clang, sysroot_flags)))
44 config.substitutions.append( ('%clang', ' %s %s %s ' % (dtrace_wrapper, config.clang, sysroot_flags) ) )
45 config.substitutions.append( ('%test_root', config.test_exec_root ) )