Author: Ella Ma Date: 2021-03-24T11:32:57+01:00 New Revision: 1d8fc086ae26a1f973b25387b5063f1e801dc0f7
URL: https://github.com/llvm/llvm-project/commit/1d8fc086ae26a1f973b25387b5063f1e801dc0f7 DIFF: https://github.com/llvm/llvm-project/commit/1d8fc086ae26a1f973b25387b5063f1e801dc0f7.diff LOG: [clang][lit] Allow test cases to use the compiler that are used to compile Clang Required by D83660. Test cases may want to use the host compiler to compile some mocks for the test case. This patch adds two substitutions `%host_cc` and `%host_cxx` to use the host compilers set via variable `CMAKE_C_COMPILER` and `CMAKE_CXX_COMPILER`. Patch by Ella Ma! Reviewed By: steakhal Differential Revision: https://reviews.llvm.org/D98918 Added: Modified: clang/test/lit.cfg.py clang/test/lit.site.cfg.py.in Removed: ################################################################################ diff --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py index 863ab444fb02..f9f49d7d2278 100644 --- a/clang/test/lit.cfg.py +++ b/clang/test/lit.cfg.py @@ -92,6 +92,9 @@ ('%hmaptool', "'%s' %s" % (config.python_executable, os.path.join(config.clang_tools_dir, 'hmaptool')))) +config.substitutions.append(('%host_cc', config.host_cc)) +config.substitutions.append(('%host_cxx', config.host_cxx)) + # Plugins (loadable modules) if config.has_plugins and config.llvm_plugin_ext: diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in index c3382e2c1c42..85526b9d30d6 100644 --- a/clang/test/lit.site.cfg.py.in +++ b/clang/test/lit.site.cfg.py.in @@ -15,6 +15,7 @@ config.clang_src_dir = path(r"@CLANG_SOURCE_DIR@") config.clang_tools_dir = path(r"@CLANG_TOOLS_DIR@") config.host_triple = "@LLVM_HOST_TRIPLE@" config.target_triple = "@TARGET_TRIPLE@" +config.host_cc = "@CMAKE_C_COMPILER@" config.host_cxx = "@CMAKE_CXX_COMPILER@" config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" config.have_zlib = @LLVM_ENABLE_ZLIB@ _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits