Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 40cf2e83 authored by Carmelo Messina's avatar Carmelo Messina
Browse files

Add kill switch for unsupported clangd flags: updated patch for clangd v21

parent 07308bad
Loading
Loading
Loading
Loading
+34 −17
Original line number Diff line number Diff line
@@ -7,13 +7,31 @@ Allows build with clangd by suppressing unsupported parameters
Original License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
---
 build/config/compiler/BUILD.gn | 11 ++++++++++-
 build/config/compiler/BUILD.gn | 14 +++++++++++---
 build_overrides/build.gni      |  3 +++
 2 files changed, 13 insertions(+), 1 deletion(-)
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -634,7 +634,7 @@ config("compiler") {
 
     # TODO(crbug.com/413427035): Remove once
     # https://github.com/llvm/llvm-project/pull/136867/ is landed.
-    if (!is_win && !llvm_android_mainline &&
+    if (!is_win && !llvm_android_mainline && !skip_clangd_unsupported_options &&
         default_toolchain != "//build/toolchain/cros:target") {
       cflags += [ "-fextend-variable-liveness=none" ]
     }
@@ -1728,7 +1728,7 @@ config("clang_revision") {
 config("clang_warning_suppression") {
   # Some build configs use older versions of clang that don't support WSMs
   if (!is_nacl && default_toolchain != "//build/toolchain/cros:target" &&
-      !llvm_android_mainline && is_clang &&
+      !llvm_android_mainline && is_clang && !skip_clangd_unsupported_options &&
       clang_warning_suppression_file != "") {
     from_build_root =
         rebase_path(clang_warning_suppression_file, root_build_dir)
@@ -2065,7 +2065,6 @@ config("default_warnings") {
         # TODO(crbug.com/376641662): Fix and re-enable.
         "-Wno-nontrivial-memcall",
@@ -22,23 +40,22 @@ diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
       cflags_cc += [
         # TODO(crbug.com/328490295): Fix and re-enable for C flags.
         "-Wenum-compare-conditional",
@@ -2091,6 +2090,16 @@ config("default_warnings") {
       # other issues if the versions are incompatible.
       cflags += [ "-Wno-version-check" ]
       ldflags += [ "-Wno-version-check" ]
@@ -2104,6 +2103,15 @@ config("default_warnings") {
       ]
     }
 
+    if (skip_clangd_unsupported_options) {
+      cflags -= [
+        "-Wno-thread-safety-reference-return",
+        "-Wno-nontrivial-memcall",
+      ]
+      cflags_cc -= [
+          "-Wno-c++11-narrowing-const-reference",
+          "-Wno-missing-template-arg-list-after-template-kw",
+      ]
+    }
     }
 
     # Some builders, such as Cronet, use a different version of Clang than
+
     # Disable the GNU line marker warning when building a target with Icecc,
     # ccache, or both. This warning appears frequently when compiling
     # files that use GNU-style line markers with Clang and Icecc. It can
diff --git a/build_overrides/build.gni b/build_overrides/build.gni
--- a/build_overrides/build.gni
+++ b/build_overrides/build.gni