[gn build] make stage2_unix_toolchain set clang_base_path

This fixes the build of compiler-rt on macOS when _not_ using
clang_base_path in args.gn: Xcode clang knows where to find the
SDK, but regular clang doesn't and needs a -isysroot parameter.
We correctly add that parameter when clang_base_path is set,
but else we omit it. If clang_base_path was not set, we also
didn't add the flag for stage2_unix_toolchain() when we build
compiler-rt with just-built clang.

Make stage2_unix_toolchain() use clang_base_path instead of setting
cc / cxx. It's less code, and it gets things like this right.
diff --git a/llvm/utils/gn/build/toolchain/BUILD.gn b/llvm/utils/gn/build/toolchain/BUILD.gn
index 86e95d3..1f963ca 100644
--- a/llvm/utils/gn/build/toolchain/BUILD.gn
+++ b/llvm/utils/gn/build/toolchain/BUILD.gn
@@ -11,8 +11,26 @@
 
 template("unix_toolchain") {
   toolchain(target_name) {
+    # https://groups.google.com/a/chromium.org/d/msg/gn-dev/F_lv5T-tNDM
+    forward_variables_from(invoker.toolchain_args, "*")
+    not_needed("*")
+
     forward_variables_from(invoker, "*")
 
+    cc = "cc"
+    cxx = "c++"
+
+    if (clang_base_path != "") {
+      cc = "$clang_base_path/bin/clang"
+      cxx = "$clang_base_path/bin/clang++"
+    }
+
+    ld = cxx  # Don't use goma wrapper for linking.
+    if (use_goma) {
+      cc = "$goma_dir/gomacc $cc"
+      cxx = "$goma_dir/gomacc $cxx"
+    }
+
     tool("cc") {
       depfile = "{{output}}.d"
       command = "$cc -MMD -MF $depfile -o {{output}} -c {{source}} {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}}"
@@ -128,20 +146,6 @@
 }
 
 unix_toolchain("unix") {
-  cc = "cc"
-  cxx = "c++"
-
-  if (clang_base_path != "") {
-    cc = "$clang_base_path/bin/clang"
-    cxx = "$clang_base_path/bin/clang++"
-  }
-
-  ld = cxx  # Don't use goma wrapper for linking.
-  if (use_goma) {
-    cc = "$goma_dir/gomacc $cc"
-    cxx = "$goma_dir/gomacc $cxx"
-  }
-
   if (current_os != "mac") {
     ar = "ar"
   }
@@ -156,13 +160,11 @@
 # as compiler and linker.
 template("stage2_unix_toolchain") {
   unix_toolchain(target_name) {
-    forward_variables_from(invoker, "*")
+    toolchain_args = {
+      forward_variables_from(invoker.toolchain_args, "*")
 
-    cc = "bin/clang"
-    cxx = "bin/clang++"
-    ld = cxx
-    if (current_os != "mac") {
-      ar = "bin/llvm-ar"
+      clang_base_path = "."
+      use_goma = false
     }
 
     deps = [
@@ -170,6 +172,7 @@
       "//:lld($host_toolchain)",
     ]
     if (current_os != "mac") {
+      ar = "bin/llvm-ar"
       deps += [ "//:llvm-ar($host_toolchain)" ]
     }
   }
@@ -179,8 +182,6 @@
   toolchain_args = {
     current_os = host_os
     current_cpu = host_cpu
-    is_clang = true
-    use_lld = host_os != "mac"
   }
 }
 
@@ -189,8 +190,6 @@
     toolchain_args = {
       current_os = "android"
       current_cpu = "arm64"
-      is_clang = true
-      use_lld = true
     }
   }
 
@@ -198,8 +197,6 @@
     toolchain_args = {
       current_os = "android"
       current_cpu = "arm"
-      is_clang = true
-      use_lld = true
     }
   }
 }