Exemple #1
0
llvm_config.with_environment('PATH', config.flang_tools_dir, append_path=True)
llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True)

if config.flang_standalone_build:
    # For builds with FIR, set path for tco and enable related tests
    if config.flang_llvm_tools_dir != "":
        config.available_features.add('fir')
        if config.llvm_tools_dir != config.flang_llvm_tools_dir:
            llvm_config.with_environment('PATH',
                                         config.flang_llvm_tools_dir,
                                         append_path=True)

# For each occurrence of a flang tool name, replace it with the full path to
# the build directory holding that tool.
tools = [
    ToolSubst('%flang', command=FindTool('flang-new'), unresolved='fatal'),
    ToolSubst('%flang_fc1',
              command=FindTool('flang-new'),
              extra_args=['-fc1'],
              unresolved='fatal')
]

# Flang has several unimplemented features. TODO messages are used to mark and fail if these
# features are exercised. TODOs exit with an error in non-assert builds but in assert builds
# it aborts. To catch aborts, the `--crash` option for the `not` command has to be used.
if 'asserts' in config.available_features:
    tools.append(
        ToolSubst('%not_todo_cmd',
                  command=FindTool('not'),
                  extra_args=['--crash'],
                  unresolved='fatal'))
Exemple #2
0
if asan_rtlib:
    ld64_cmd = 'DYLD_INSERT_LIBRARIES={} {}'.format(asan_rtlib, ld64_cmd)

ocamlc_command = '%s ocamlc -cclib -L%s %s' % (
    config.ocamlfind_executable, config.llvm_lib_dir, config.ocaml_flags)
ocamlopt_command = 'true'
if config.have_ocamlopt:
    ocamlopt_command = '%s ocamlopt -cclib -L%s -cclib -Wl,-rpath,%s %s' % (
        config.ocamlfind_executable, config.llvm_lib_dir, config.llvm_lib_dir,
        config.ocaml_flags)

opt_viewer_cmd = '%s %s/tools/opt-viewer/opt-viewer.py' % (
    sys.executable, config.llvm_src_root)

tools = [
    ToolSubst('%lli', FindTool('lli'), post='.', extra_args=lli_args),
    ToolSubst('%llc_dwarf', FindTool('llc'), extra_args=llc_args),
    ToolSubst('%go', config.go_executable, unresolved='ignore'),
    ToolSubst('%gold', config.gold_executable, unresolved='ignore'),
    ToolSubst('%ld64', ld64_cmd, unresolved='ignore'),
    ToolSubst('%ocamlc', ocamlc_command, unresolved='ignore'),
    ToolSubst('%ocamlopt', ocamlopt_command, unresolved='ignore'),
    ToolSubst('%opt-viewer', opt_viewer_cmd),
]

# FIXME: Why do we have both `lli` and `%lli` that do slightly different things?
tools.extend([
    'lli', 'lli-child-target', 'llvm-ar', 'llvm-as', 'llvm-bcanalyzer',
    'llvm-config', 'llvm-cov', 'llvm-cxxdump', 'llvm-cvtres', 'llvm-diff',
    'llvm-dis', 'llvm-dsymutil', 'llvm-dwarfdump', 'llvm-extract',
    'llvm-isel-fuzzer', 'llvm-opt-fuzzer', 'llvm-lib', 'llvm-link', 'llvm-lto',
llvm_config.with_system_environment(
    ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH'])

config.substitutions.append(('%PATH%', config.environment['PATH']))


# For each occurrence of a clang tool name, replace it with the full path to
# the build directory holding that tool.  We explicitly specify the directories
# to search to ensure that we get the tools just built and not some random
# tools that might happen to be in the user's PATH.
tool_dirs = [config.clang_tools_dir, config.llvm_tools_dir]

tools = [
    'apinotes-test', 'c-index-test', 'clang-diff', 'clang-format',
    'clang-tblgen', 'opt', 'llvm-ifs', 'yaml2obj',
    ToolSubst('%clang_extdef_map', command=FindTool(
        'clang-extdef-mapping'), unresolved='ignore'),
]

if config.clang_examples:
    config.available_features.add('examples')
    tools.append('clang-interpreter')

if config.clang_staticanalyzer:
    config.available_features.add('staticanalyzer')
    tools.append('clang-check')

    if config.clang_staticanalyzer_z3 == '1':
        config.available_features.add('z3')

    check_analyzer_fixit_path = os.path.join(
        config.test_source_root, "Analysis", "check-analyzer-fixit.py")
llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True)

if config.flang_standalone_build:
    # For builds with FIR, set path for tco and enable related tests
    if config.flang_llvm_tools_dir != "":
        config.available_features.add('fir')
        if config.llvm_tools_dir != config.flang_llvm_tools_dir:
            llvm_config.with_environment('PATH',
                                         config.flang_llvm_tools_dir,
                                         append_path=True)

# For each occurrence of a flang tool name, replace it with the full path to
# the build directory holding that tool.
tools = [
    ToolSubst('%f18',
              command=FindTool('f18'),
              extra_args=[
                  "-intrinsic-module-directory " +
                  config.flang_intrinsic_modules_dir
              ],
              unresolved='fatal')
]

if config.include_flang_new_driver_test:
    tools.append(
        ToolSubst('%flang-new',
                  command=FindTool('flang-new'),
                  unresolved='fatal'))

if config.flang_standalone_build:
    llvm_config.add_tool_substitutions(tools, [config.flang_llvm_tools_dir])
Exemple #5
0
# excludes: A list of directories to exclude from the testsuite.
config.excludes = ['CMakeLists.txt']

# test_source_root: The root path where tests are located.
config.test_source_root = os.path.dirname(__file__)

# test_exec_root: The root path where tests should be run.
config.test_exec_root = os.path.join(config.soll_obj_root, 'test')

llvm_config.use_default_substitutions()

tool_substitutions = [
    ToolSubst('%soll', command=config.soll, extra_args=[]),
]
llvm_config.add_tool_substitutions(tool_substitutions)

# For each occurrence of a soll tool name, replace it with the full path to
# the build directory holding that tool. We explicitly specify the directories
# to search to ensure that we get the tools just built and not some random
# tools that might happen to be in the user's PATH.
tool_dirs = [config.soll_tools_dir, config.llvm_tools_dir]

tools = [
    'opt',
    ToolSubst('%soll_extdef_map',
              command=FindTool('soll-extdef-mapping'),
              unresolved='ignore'),
]

llvm_config.add_tool_substitutions(tools, tool_dirs)
Exemple #6
0
# For each occurrence of a clang tool name, replace it with the full path to
# the build directory holding that tool.  We explicitly specify the directories
# to search to ensure that we get the tools just built and not some random
# tools that might happen to be in the user's PATH.
tool_dirs = [config.clang_tools_dir, config.llvm_tools_dir]

tools = [
    'c-index-test',
    'clang-diff',
    'clang-format',
    'clang-tblgen',
    'opt',
    'llvm-ifs',
    ToolSubst('%clang_extdef_map',
              command=FindTool('clang-extdef-mapping'),
              unresolved='ignore'),
]

if config.clang_examples:
    config.available_features.add('examples')
    tools.append('clang-interpreter')

if config.clang_staticanalyzer:
    config.available_features.add('staticanalyzer')
    tools.append('clang-check')

    if config.clang_staticanalyzer_z3 == '1':
        config.available_features.add('z3')

    check_analyzer_fixit_path = os.path.join(config.test_source_root,
Exemple #7
0
if asan_rtlib:
    ld64_cmd = 'DYLD_INSERT_LIBRARIES={} {}'.format(asan_rtlib, ld64_cmd)

ocamlc_command = '%s ocamlc -cclib -L%s %s' % (
    config.ocamlfind_executable, config.llvm_lib_dir, config.ocaml_flags)
ocamlopt_command = 'true'
if config.have_ocamlopt:
    ocamlopt_command = '%s ocamlopt -cclib -L%s -cclib -Wl,-rpath,%s %s' % (
        config.ocamlfind_executable, config.llvm_lib_dir, config.llvm_lib_dir,
        config.ocaml_flags)

opt_viewer_cmd = '%s %s/tools/opt-viewer/opt-viewer.py' % (
    sys.executable, config.llvm_src_root)

tools = [
    ToolSubst('%lli', FindTool('lli'), post='.', extra_args=lli_args),
    ToolSubst('%llc_dwarf', FindTool('llc'), extra_args=llc_args),
    ToolSubst('%go', config.go_executable, unresolved='ignore'),
    ToolSubst('%gold', config.gold_executable, unresolved='ignore'),
    ToolSubst('%ld64', ld64_cmd, unresolved='ignore'),
    ToolSubst('%ocamlc', ocamlc_command, unresolved='ignore'),
    ToolSubst('%ocamlopt', ocamlopt_command, unresolved='ignore'),
    ToolSubst('%opt-viewer', opt_viewer_cmd),
    ToolSubst('%llvm-objcopy', FindTool('llvm-objcopy')),
    ToolSubst('%llvm-strip', FindTool('llvm-strip')),
]

# FIXME: Why do we have both `lli` and `%lli` that do slightly different things?
tools.extend([
    'dsymutil', 'lli', 'lli-child-target', 'llvm-ar', 'llvm-as',
    'llvm-bcanalyzer', 'llvm-config', 'llvm-cov', 'llvm-cxxdump',
Exemple #8
0
# to search to ensure that we get the tools just built and not some random
# tools that might happen to be in the user's PATH.
tool_dirs = [config.clang_tools_dir, config.llvm_tools_dir]

tools = [
    'llvm-readobj',
    'llvm-objdump',
    'llvm-dwarfdump',  # XXXAR: needed by some CHERI tests
    'c-index-test',
    'clang-check',
    'clang-diff',
    'clang-format',
    'clang-tblgen',
    'opt',
    ToolSubst('%clang_func_map',
              command=FindTool('clang-func-mapping'),
              unresolved='ignore'),
]

if config.clang_examples:
    config.available_features.add('examples')
    tools.append('clang-interpreter')

llvm_config.add_tool_substitutions(tools, tool_dirs)

config.substitutions.append(
    ('%hmaptool',
     "'%s' %s" % (config.python_executable,
                  os.path.join(config.llvm_tools_dir, 'hmaptool'))))

# Plugins (loadable modules)
Exemple #9
0
# Tweak the PATH to include the tools dir.
llvm_config.with_environment('PATH', config.flang_tools_dir, append_path=True)
llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True)

if config.flang_standalone_build:
    # For builds with FIR, set path for tco and enable related tests
    if config.flang_llvm_tools_dir != "":
        config.available_features.add('fir')
        if config.llvm_tools_dir != config.flang_llvm_tools_dir:
            llvm_config.with_environment('PATH', config.flang_llvm_tools_dir, append_path=True)

# For each occurrence of a flang tool name, replace it with the full path to
# the build directory holding that tool.
tools = [
        ToolSubst('%flang', command=FindTool('flang-new'), unresolved='fatal'),
    ToolSubst('%flang_fc1', command=FindTool('flang-new'), extra_args=['-fc1'],
        unresolved='fatal')]

# Define some variables to help us test that the flang runtime doesn't depend on
# the C++ runtime libraries. For this we need a C compiler. If for some reason
# we don't have one, we can just disable the test.
if config.cc:
    libruntime = os.path.join(config.flang_lib_dir, 'libFortranRuntime.a')
    includes = os.path.join(config.flang_src_dir, 'runtime')

    if os.path.isfile(libruntime) and os.path.isdir(includes):
        config.available_features.add('c-compiler')
        tools.append(ToolSubst('%cc', command=config.cc, unresolved='fatal'))
        tools.append(ToolSubst('%libruntime', command=libruntime,
            unresolved='fatal'))
Exemple #10
0
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']

    build_script = os.path.dirname(__file__)
    build_script = os.path.join(build_script, 'build.py')
    build_script_args = [
        build_script,
        '--compiler=any',  # Default to best compiler
        '--arch=' + str(config.lldb_bitness)
    ]
    if config.lldb_lit_tools_dir:
        build_script_args.append('--tools-dir={0}'.format(
            config.lldb_lit_tools_dir))
    if config.lldb_tools_dir:
        build_script_args.append('--tools-dir={0}'.format(
            config.lldb_tools_dir))
    if config.llvm_libs_dir:
        build_script_args.append('--libs-dir={0}'.format(config.llvm_libs_dir))

    lldb_init = _get_lldb_init_path(config)

    primary_tools = [
        ToolSubst('%lldb',
                  command=FindTool('lldb'),
                  extra_args=['--no-lldbinit', '-S', lldb_init],
                  unresolved='fatal'),
        ToolSubst('%lldb-init',
                  command=FindTool('lldb'),
                  extra_args=['-S', lldb_init],
                  unresolved='fatal'),
        ToolSubst('%lldb-noinit',
                  command=FindTool('lldb'),
                  extra_args=['--no-lldbinit'],
                  unresolved='fatal'),
        ToolSubst('%lldb-server',
                  command=FindTool("lldb-server"),
                  extra_args=[],
                  unresolved='ignore'),
        ToolSubst('%debugserver',
                  command=FindTool(dsname),
                  extra_args=dsargs,
                  unresolved='ignore'),
        ToolSubst('%platformserver',
                  command=FindTool('lldb-server'),
                  extra_args=['platform'],
                  unresolved='ignore'), 'lldb-test', 'lldb-instr',
        'lldb-vscode',
        ToolSubst('%build',
                  command="'" + sys.executable + "'",
                  extra_args=build_script_args)
    ]

    _disallow(config, 'lldb')
    _disallow(config, 'lldb-server')
    _disallow(config, 'debugserver')
    _disallow(config, 'platformserver')

    llvm_config.add_tool_substitutions(primary_tools, [config.lldb_tools_dir])
Exemple #11
0
llvm_config.with_environment('PATH', config.flang_tools_dir, append_path=True)
llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True)

if config.flang_standalone_build:
    # For builds with FIR, set path for tco and enable related tests
    if config.flang_llvm_tools_dir != "":
        config.available_features.add('fir')
        if config.llvm_tools_dir != config.flang_llvm_tools_dir:
            llvm_config.with_environment('PATH',
                                         config.flang_llvm_tools_dir,
                                         append_path=True)

# For each occurrence of a flang tool name, replace it with the full path to
# the build directory holding that tool.
tools = [
    ToolSubst('%flang', command=FindTool('flang-new'), unresolved='fatal'),
    ToolSubst('%flang_fc1',
              command=FindTool('flang-new'),
              extra_args=['-fc1'],
              unresolved='fatal')
]

# Define some variables to help us test that the flang runtime doesn't depend on
# the C++ runtime libraries. For this we need a C compiler. If for some reason
# we don't have one, we can just disable the test.
if config.cc:
    libruntime = os.path.join(config.flang_lib_dir, 'libFortranRuntime.a')
    libdecimal = os.path.join(config.flang_lib_dir, 'libFortranDecimal.a')
    include = os.path.join(config.flang_src_dir, 'include')

    if os.path.isfile(libruntime) and os.path.isfile(
Exemple #12
0
# directories.
config.excludes = ['Inputs', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt']

# test_source_root: The root path where tests are located.
config.test_source_root = os.path.dirname(__file__)

# test_exec_root: The root path where tests should be run.
config.test_exec_root = os.path.join(config.flang_obj_root, 'test-lit')

# Tweak the PATH to include the tools dir.
llvm_config.with_environment('PATH', config.flang_tools_dir, append_path=True)
llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True)

# For each occurrence of a flang tool name, replace it with the full path to
# the build directory holding that tool.  We explicitly specify the directories
# to search to ensure that we get the tools just built and not some random
# tools that might happen to be in the user's PATH.
tool_dirs = [config.llvm_tools_dir, config.flang_tools_dir]
flang_includes = "-I" + config.flang_intrinsic_modules_dir

tools = [
    ToolSubst('%flang', command=FindTool('flang'), unresolved='fatal'),
    ToolSubst('%f18', command=FindTool('f18'), unresolved='fatal'),
    ToolSubst('%f18_with_includes',
              command=FindTool('f18'),
              extra_args=[flang_includes],
              unresolved='fatal')
]

llvm_config.add_tool_substitutions(tools, tool_dirs)
Exemple #13
0
    def _add_cheri_tool_substitution(self, tool):
        assert tool in ('llc', 'opt', 'llvm-mc'), 'Invalid tool: ' + tool
        default_cheri_size = self.lit_config.params['CHERI_CAP_SIZE']
        self.config.substitutions.append(
            (r"\b{tool}\b.+\-target-abi\s+purecap\b",
             "\"---Don't use {tool} -target-abi purecap, "
             "use %cheri[128/256]_purecap_{tool} instead ---\"".format(
                 tool=tool)))
        self.config.substitutions.append(
            (r"\b{tool}\b.+\-mcpu=cheri.+",
             "\"---Don't use {tool} -mcpu=cheri, "
             "use %cheri[128/256]_{tool} instead ---\"".format(tool=tool)))

        if tool == 'llvm-mc':
            triple_arg = '-triple=cheri-unknown-freebsd'
            purecap_args = ['-target-abi', 'purecap', '-position-independent']
        else:
            triple_arg = '-mtriple=cheri-unknown-freebsd'
            purecap_args = [
                '-target-abi', 'purecap', '-relocation-model', 'pic'
            ]
        extra_args = []
        if tool == "llc":  # TODO: add this to clang as well?
            extra_args = ["-verify-machineinstrs"]
        cheri128_args = [triple_arg, '-mcpu=cheri128', '-mattr=+cheri128'
                         ] + extra_args
        cheri256_args = [triple_arg, '-mcpu=cheri256', '-mattr=+cheri256'
                         ] + extra_args

        if default_cheri_size == '16':
            self.config.available_features.add("cheri_is_128")
            self.config.substitutions.append(('%cheri_type', 'CHERI128'))
            default_args = cheri128_args
        else:
            assert default_cheri_size == '32', "Invalid -DCHERI_CAP_SIZE=" + default_cheri_size
            self.config.substitutions.append(('%cheri_type', 'CHERI256'))
            self.config.available_features.add("cheri_is_256")
            default_args = cheri256_args
        self.config.substitutions.append(
            ('%cheri_cap_bytes', default_cheri_size))
        tool_patterns = [
            ToolSubst('%cheri_' + tool,
                      FindTool(tool),
                      extra_args=default_args),
            ToolSubst('%cheri128_' + tool,
                      FindTool(tool),
                      extra_args=cheri128_args),
            ToolSubst('%cheri256_' + tool,
                      FindTool(tool),
                      extra_args=cheri256_args),
            ToolSubst('%cheri_purecap_' + tool,
                      FindTool(tool),
                      extra_args=default_args + purecap_args),
            ToolSubst('%cheri128_purecap_' + tool,
                      FindTool(tool),
                      extra_args=cheri128_args + purecap_args),
            ToolSubst('%cheri256_purecap_' + tool,
                      FindTool(tool),
                      extra_args=cheri256_args + purecap_args),
        ]
        self.add_tool_substitutions(tool_patterns,
                                    [self.config.llvm_tools_dir])
Exemple #14
0
# Tweak the PATH to include the tools dir.
llvm_config.with_environment('PATH', config.flang_tools_dir, append_path=True)
llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True)

if config.flang_standalone_build:
    # For builds with FIR, set path for tco and enable related tests
    if config.flang_llvm_tools_dir != "":
        config.available_features.add('fir')
        if config.llvm_tools_dir != config.flang_llvm_tools_dir:
            llvm_config.with_environment('PATH', config.flang_llvm_tools_dir, append_path=True)

# For each occurrence of a flang tool name, replace it with the full path to
# the build directory holding that tool.
tools = [
  ToolSubst('%f18', command=FindTool('f18'),
    unresolved='fatal')
]

if config.include_flang_new_driver_test:
   tools.append(ToolSubst('%flang-new', command=FindTool('flang-new'), unresolved='fatal'))
   tools.append(ToolSubst('%flang', command=FindTool('flang-new'), unresolved='fatal'))
   tools.append(ToolSubst('%flang_fc1', command=FindTool('flang-new'),
    extra_args=['-fc1'], unresolved='fatal'))
else:
   tools.append(ToolSubst('%flang', command=FindTool('f18'),
    unresolved='fatal'))
   tools.append(ToolSubst('%flang_fc1', command=FindTool('f18'),
    unresolved='fatal'))

if config.flang_standalone_build:
Exemple #15
0
config.substitutions.append(('%cxxflags', '-no-pie'))

tool_dirs = [config.llvm_tools_dir, config.test_source_root]

linker_tool = llvm_config.use_llvm_tool('ld', required=True)
tools = [
    ToolSubst('llvm-dwarfdump', unresolved='fatal'),
    ToolSubst('llvm-bolt', unresolved='fatal'),
    ToolSubst('perf2bolt', unresolved='fatal'),
    ToolSubst('yaml2obj', unresolved='fatal'),
    ToolSubst('llvm-mc', unresolved='fatal'),
    ToolSubst('llvm-nm', unresolved='fatal'),
    ToolSubst('llvm-strip', unresolved='fatal'),
    ToolSubst('linker', command=linker_tool, unresolved='fatal'),
    ToolSubst('link_fdata',
              command=FindTool('link_fdata.sh'),
              unresolved='fatal'),
]
llvm_config.add_tool_substitutions(tools, tool_dirs)


def calculate_arch_features(arch_string):
    features = []
    for arch in arch_string.split():
        features.append(arch.lower() + '-registered-target')
    return features


llvm_config.feature_config([('--assertion-mode', {
    'ON': 'asserts'
}), ('--cxxflags', {
Exemple #16
0
if config.have_ocamlopt:
    ocamlopt_command = '%s ocamlopt -cclib -L%s -cclib -Wl,-rpath,%s %s' % (
        config.ocamlfind_executable, config.llvm_lib_dir, config.llvm_lib_dir,
        config.ocaml_flags)

opt_viewer_cmd = '%s %s/tools/opt-viewer/opt-viewer.py' % (
    sys.executable, config.llvm_src_root)

llvm_locstats_tool = os.path.join(config.llvm_tools_dir, 'llvm-locstats')
config.substitutions.append(
    ('%llvm-locstats',
     "'%s' %s" % (config.python_executable, llvm_locstats_tool)))
config.llvm_locstats_used = os.path.exists(llvm_locstats_tool)

tools = [
    ToolSubst('%lli', FindTool('lli'), post='.', extra_args=lli_args),
    ToolSubst('%llc_dwarf', FindTool('llc'), extra_args=llc_args),
    ToolSubst('%go', config.go_executable, unresolved='ignore'),
    ToolSubst('%gold', config.gold_executable, unresolved='ignore'),
    ToolSubst('%ld64', ld64_cmd, unresolved='ignore'),
    ToolSubst('%ocamlc', ocamlc_command, unresolved='ignore'),
    ToolSubst('%ocamlopt', ocamlopt_command, unresolved='ignore'),
    ToolSubst('%opt-viewer', opt_viewer_cmd),
    ToolSubst('%llvm-objcopy', FindTool('llvm-objcopy')),
    ToolSubst('%llvm-strip', FindTool('llvm-strip')),
    ToolSubst('%llvm-install-name-tool', FindTool('llvm-install-name-tool')),
    ToolSubst('%llvm-bitcode-strip', FindTool('llvm-bitcode-strip')),
    ToolSubst('%split-file', FindTool('split-file')),
]

# FIXME: Why do we have both `lli` and `%lli` that do slightly different things?
Exemple #17
0
config.environment['CLANG_BINARY'] = os.getenv('CLANG_BINARY')

llvm_config.use_default_substitutions()

# excludes: A list of directories to exclude from the testsuite. The 'Inputs'
# subdirectories contain auxiliary inputs for various tests in their parent
# directories.
config.excludes = ['input', 'CMakeLists.txt']

# test_source_root: The root path where tests are located.
config.test_source_root = os.path.dirname(__file__)

# test_exec_root: The root path where tests should be run.
config.test_exec_root = os.path.join(config.fc_obj_root, 'test')

# Tweak the PATH to include the tools dir.
llvm_config.with_environment('PATH', config.fc_tools_dir, append_path=True)
llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True)

# For each occurrence of a fc tool name, replace it with the full path to
# the build directory holding that tool.  We explicitly specify the directories
# to search to ensure that we get the tools just built and not some random
# tools that might happen to be in the user's PATH.
tool_dirs = [config.llvm_tools_dir, config.fc_tools_dir]

tools = [ToolSubst('%fc', command=FindTool('fc'), unresolved='fatal')]

llvm_config.add_tool_substitutions(tools, tool_dirs)