From cf30b6c5ecd1dc864bf25c3eea3c3b420797d6f3 Mon Sep 17 00:00:00 2001
From: zxstty <zhaojiaqi18@huawei.com>
Date: Thu, 9 Nov 2023 11:10:53 +0800
Subject: [PATCH] 0013

---
 build_scripts/build.sh      | 3 +--
 config/clang/clang.gni      | 4 ++--
 config/ohos/BUILD.gn        | 2 +-
 config/ohos/config.gni      | 2 +-
 toolchain/gcc_toolchain.gni | 2 +-
 toolchain/toolchain.gni     | 2 +-
 6 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/build_scripts/build.sh b/build_scripts/build.sh
index dea04e9..f17f9fe 100755
--- a/build_scripts/build.sh
+++ b/build_scripts/build.sh
@@ -114,7 +114,6 @@ esac
 PYTHON3_DIR=/usr
 PYTHON3=${PYTHON3_DIR}/bin/python3
 PYTHON=${PYTHON3_DIR}/bin/python
-LLVM=/usr/lib64/llvm15/bin
 if [[ ! -f "${PYTHON3}" ]]; then
   echo -e "\033[33m Please execute the build/prebuilts_download.sh \033[0m"
   exit 1
@@ -124,7 +123,7 @@ else
   fi
 fi
 
-export PATH=${source_root_dir}/prebuilts/build-tools/${HOST_DIR}/bin:${PYTHON3_DIR}/bin:${LLVM}:$PATH
+export PATH=${source_root_dir}/prebuilts/build-tools/${HOST_DIR}/bin:${PYTHON3_DIR}/bin:$PATH
 
 ${PYTHON3} ${source_root_dir}/build/scripts/tools_checker.py
 
diff --git a/config/clang/clang.gni b/config/clang/clang.gni
index 38719bb..9728e12 100755
--- a/config/clang/clang.gni
+++ b/config/clang/clang.gni
@@ -4,9 +4,9 @@
 
 import("//build/toolchain/toolchain.gni")
 
-default_clang_base_path = "//prebuilts/clang/ohos/${host_platform_dir}/llvm"
+default_clang_base_path = "/usr/lib64/llvm15/"
 clang_lib_path =
-    "//prebuilts/clang/ohos/${host_platform_dir}/llvm/lib/clang/12.0.1/lib"
+    "${default_clang_base_path}/lib/clang/15.0.7/lib"
 
 declare_args() {
   # Indicates if the build should use the Chrome-specific plugins for enforcing
diff --git a/config/ohos/BUILD.gn b/config/ohos/BUILD.gn
index f177a03..84a3ea1 100755
--- a/config/ohos/BUILD.gn
+++ b/config/ohos/BUILD.gn
@@ -79,7 +79,7 @@ config("runtime_library") {
 
   ldflags += [
     "-L" + rebase_path("${musl_sysroot}/usr/lib/${abi_target}", root_build_dir),
-    "-L" + rebase_path("${clang_base_path}/lib/clang/12.0.1/lib/${abi_target}",
+    "-L" + rebase_path("${clang_base_path}/lib/clang/15.0.7/lib/${abi_target}",
                        root_build_dir),
   ]
 
diff --git a/config/ohos/config.gni b/config/ohos/config.gni
index b7e1c45..e5d4d54 100644
--- a/config/ohos/config.gni
+++ b/config/ohos/config.gni
@@ -37,5 +37,5 @@ if (is_ohos) {
     assert(false, "Architecture not supported")
   }
 
-  libclang_rt_file = "${clang_base_path}/lib/clang/12.0.1/lib/${abi_target}/libclang_rt.builtins.a"
+  libclang_rt_file = "${clang_base_path}/lib/clang/15.0.7/lib/${abi_target}/libclang_rt.builtins.a"
 }
diff --git a/toolchain/gcc_toolchain.gni b/toolchain/gcc_toolchain.gni
index 0c91ccf..6a68e42 100755
--- a/toolchain/gcc_toolchain.gni
+++ b/toolchain/gcc_toolchain.gni
@@ -585,7 +585,7 @@ template("clang_toolchain") {
 
   gcc_toolchain(target_name) {
     # prefix = rebase_path("$clang_base_path/bin", root_build_dir)
-    prefix = "/usr/bin"
+    prefix = "/usr/lib64/llvm15/bin"
     cc = "$prefix/clang"
     cxx = "$prefix/clang++"
     ld = cxx
diff --git a/toolchain/toolchain.gni b/toolchain/toolchain.gni
index 1e95b63..7794e6f 100755
--- a/toolchain/toolchain.gni
+++ b/toolchain/toolchain.gni
@@ -46,7 +46,7 @@ hermetic_xcode_path =
 declare_args() {
   if (is_clang) {
     # Clang compiler version. Clang files are placed at version-dependent paths.
-    clang_version = "12.0.1"
+    clang_version = "15.0.7"
   }
   use_custom_clang = true
 }
-- 
2.33.0

