diff --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn --- a/llvm/utils/gn/build/BUILD.gn +++ b/llvm/utils/gn/build/BUILD.gn @@ -266,7 +266,7 @@ ] } } - if (is_clang && use_goma) { + if (is_clang && compiler_wrapper != "") { # goma converts all paths to lowercase on the server, breaking this # warning. cflags += [ "-Wno-nonportable-include-path" ] @@ -373,9 +373,6 @@ if (sysroot != "" && current_os != "win" && is_clang) { cflags += [ "-Wpoison-system-directories" ] } - assert( - !use_goma || sysroot != "", - "goma needs a sysroot: run `llvm/utils/sysroot.py make-fake --out-dir=sysroot` and add `sysroot = \"//sysroot\"` to your args.gn") if (use_ubsan) { assert(is_clang && (current_os == "ios" || current_os == "linux" || diff --git a/llvm/utils/gn/build/toolchain/BUILD.gn b/llvm/utils/gn/build/toolchain/BUILD.gn --- a/llvm/utils/gn/build/toolchain/BUILD.gn +++ b/llvm/utils/gn/build/toolchain/BUILD.gn @@ -1,14 +1,5 @@ import("//llvm/utils/gn/build/toolchain/compiler.gni") -declare_args() { - # If is_goma is true, the location of the goma client install. - # Set this to the output of `goma_ctl goma_dir`. - goma_dir = "" -} - -assert(!use_goma || goma_dir != "", - "set `goma_dir` to the output of `goma_ctl goma_dir` in your args.gn") - unix_copy_command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})" template("unix_toolchain") { @@ -27,10 +18,10 @@ cxx = rebase_path(clang_base_path, root_build_dir) + "/bin/clang++" } - ld = cxx # Don't use goma wrapper for linking. - if (use_goma) { - cc = "$goma_dir/gomacc $cc" - cxx = "$goma_dir/gomacc $cxx" + ld = cxx # Don't use compiler wrapper for linking. + if (compiler_wrapper != "") { + cc = "$compiler_wrapper $cc" + cxx = "$compiler_wrapper $cxx" } tool("cc") { @@ -196,7 +187,7 @@ forward_variables_from(invoker.toolchain_args, "*") clang_base_path = root_build_dir - use_goma = false + compiler_wrapper = "" } deps = [ @@ -302,8 +293,8 @@ } } - if (use_goma) { - cl = "$goma_dir/gomacc $cl" + if (compiler_wrapper != "") { + cl = "$compiler_wrapper $cl" } tool("cc") { @@ -424,7 +415,7 @@ sysroot = win_sysroot } clang_base_path = root_build_dir - use_goma = false + compiler_wrapper = "" } deps = [ "//:clang($host_toolchain)", @@ -441,7 +432,7 @@ sysroot = win_sysroot } clang_base_path = root_build_dir - use_goma = false + compiler_wrapper = "" } deps = [ "//:clang($host_toolchain)", diff --git a/llvm/utils/gn/build/toolchain/compiler.gni b/llvm/utils/gn/build/toolchain/compiler.gni --- a/llvm/utils/gn/build/toolchain/compiler.gni +++ b/llvm/utils/gn/build/toolchain/compiler.gni @@ -1,11 +1,5 @@ declare_args() { - # Whether to use goma (https://chromium.googlesource.com/infra/goma/client/) - use_goma = false - # Set this to a clang build directory. If set, that clang is used as compiler. - # goma only works with compiler binaries it knows about, so useful both for - # using a goma-approved compiler and for compiling clang with a locally-built - # clang in a different build directory. # On Windows, setting this also causes lld-link to be used as linker. # Example value: getenv("HOME") + "/src/llvm-build/Release+Asserts" clang_base_path = "" @@ -16,6 +10,9 @@ # Set this to the path of the Win SDK. Only used for cross compilation. If set, cross compilation targeting Windows will be enabled. win_sysroot = "" + + # If set, prepends this to compile action command lines (e.g. `"ccache"`). + compiler_wrapper = "" } declare_args() {