gn build: Add a resource_dir.gni file.

The path to the resource directory will end up being used in several
more places once the support for running check-hwasan lands. This
moves the definition to a central location so that it can be used
from those places.

Differential Revision: https://reviews.llvm.org/D56700

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351255 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/gn/secondary/clang/lib/Headers/BUILD.gn b/utils/gn/secondary/clang/lib/Headers/BUILD.gn
index c2b89af..2c472ce 100644
--- a/utils/gn/secondary/clang/lib/Headers/BUILD.gn
+++ b/utils/gn/secondary/clang/lib/Headers/BUILD.gn
@@ -1,5 +1,5 @@
+import("//clang/resource_dir.gni")
 import("//clang/utils/TableGen/clang_tablegen.gni")
-import("//llvm/version.gni")
 
 # Generate arm_neon.h
 clang_tablegen("arm_neon") {
@@ -15,8 +15,6 @@
   output_name = "arm_fp16.h"
 }
 
-output_dir = "$root_out_dir/lib/clang/$llvm_version/include"
-
 copy("arm_headers") {
   visibility = [ ":Headers" ]
   deps = [
@@ -25,7 +23,7 @@
   ]
   sources = get_target_outputs(":arm_neon") + get_target_outputs(":arm_fp16")
   outputs = [
-    "$output_dir/{{source_file_part}}",
+    "$clang_resource_dir/include/{{source_file_part}}",
   ]
 }
 
@@ -158,6 +156,6 @@
     "cuda_wrappers/new",
   ]
   outputs = [
-    "$output_dir/{{source_target_relative}}",
+    "$clang_resource_dir/include/{{source_target_relative}}",
   ]
 }
diff --git a/utils/gn/secondary/clang/resource_dir.gni b/utils/gn/secondary/clang/resource_dir.gni
new file mode 100644
index 0000000..b5a877a
--- /dev/null
+++ b/utils/gn/secondary/clang/resource_dir.gni
@@ -0,0 +1,3 @@
+import("//llvm/version.gni")
+
+clang_resource_dir = "$root_build_dir/lib/clang/$llvm_version"
diff --git a/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn b/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn
index 78e36cd..9f4c697 100644
--- a/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn
+++ b/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn
@@ -1,9 +1,9 @@
-import("//llvm/version.gni")
+import("//clang/resource_dir.gni")
 
 # FIXME: Make this support more platforms.
 assert(current_os == "android")
 
-runtime_output_dir = "$root_build_dir/lib/clang/$llvm_version/lib/linux"
+runtime_output_dir = "$clang_resource_dir/lib/linux"
 runtime_target = "aarch64-android"
 
 action("version_script") {