8 def getSysrootFlagsOnDarwin(config, lit_config):
9 # On Darwin, support relocatable SDKs by providing Clang with a
10 # default system root path.
11 if 'darwin' in config.target_triple:
13 out = subprocess.check_output(['xcrun', '--show-sdk-path']).strip().decode()
19 lit_config.note('using SDKROOT: %r' % sdk_path)
20 return '-isysroot %s' % sdk_path
23 sysroot_flags = getSysrootFlagsOnDarwin(config, lit_config)
25 config.clang = lit.util.which('clang', config.clang_tools_dir).replace('\\', '/')
27 config.name = 'Clang Perf Training'
28 config.suffixes = ['.c', '.cc', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl', '.s', '.S', '.modulemap', '.test']
30 cc1_wrapper = '%s %s/perf-helper.py cc1' % (config.python_exe, config.perf_helper_dir)
32 use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL")
33 config.test_format = lit.formats.ShTest(use_lit_shell == "0")
34 config.substitutions.append( ('%clang_cpp_skip_driver', ' %s %s %s ' % (cc1_wrapper, config.clang, sysroot_flags)))
35 config.substitutions.append( ('%clang_cpp', ' %s --driver-mode=g++ %s ' % (config.clang, sysroot_flags)))
36 config.substitutions.append( ('%clang_skip_driver', ' %s %s %s ' % (cc1_wrapper, config.clang, sysroot_flags)))
37 config.substitutions.append( ('%clang', ' %s %s ' % (config.clang, sysroot_flags) ) )
38 config.substitutions.append( ('%test_root', config.test_exec_root ) )
40 config.environment['LLVM_PROFILE_FILE'] = 'perf-training-%4m.profraw'