From 2ce94f822eb951dcff23036f204a98900a4fb805 Mon Sep 17 00:00:00 2001
From: wangqiang <wangqiang1@kylinos.cn>
Date: Wed, 24 Apr 2024 11:21:02 +0800
Subject: [PATCH] Ignored option `-Wa,--generate-missing-build-notes=`

---
 clang/lib/Driver/ToolChains/Clang.cpp               |  6 ++++++
 .../Driver/test-generate-missing-build-notes.cpp    | 13 +++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 clang/test/Driver/test-generate-missing-build-notes.cpp

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 6b5930990..704a32912 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2731,6 +2731,12 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
         CmdArgs.push_back(Value.data());
       } else if (Value == "--version") {
         D.PrintVersion(C, llvm::outs());
+    #ifdef BUILD_FOR_OPENEULER
+      } else if (Value.startswith("--generate-missing-build-notes=") &&
+      Args.hasFlag(options::OPT_fgcc_compatible,
+      options::OPT_fno_gcc_compatible, false)) {
+      // Do nothing.
+    #endif
       } else {
         D.Diag(diag::err_drv_unsupported_option_argument)
             << A->getSpelling() << Value;
diff --git a/clang/test/Driver/test-generate-missing-build-notes.cpp b/clang/test/Driver/test-generate-missing-build-notes.cpp
new file mode 100644
index 000000000..efd5251e6
--- /dev/null
+++ b/clang/test/Driver/test-generate-missing-build-notes.cpp
@@ -0,0 +1,13 @@
+// REQUIRES: build_for_openeuler
+// RUN: %clang -### -fgcc-compatible -Wa,--generate-missing-build-notes=yes %s 2>&1 | FileCheck -check-prefix=CHECK-NO-ERROR %s
+// RUN: %clang -### -fgcc-compatible -Wa,--generate-missing-build-notes=no %s 2>&1 | FileCheck -check-prefix=CHECK-NO-ERROR %s
+// CHECK-NO-ERROR-NOT: --generate-missing-build-notes=
+// RUN: %clang -### -Wa,--generate-missing-build-notes=yes %s 2>&1 | FileCheck -check-prefix=CHECK-ERROR %s
+// RUN: %clang -### -Wa,--generate-missing-build-notes=no %s 2>&1 | FileCheck -check-prefix=CHECK-ERROR %s
+// RUN: %clang -### -fno-gcc-compatible -Wa,--generate-missing-build-notes=yes %s 2>&1 | FileCheck -check-prefix=CHECK-ERROR %s
+// RUN: %clang -### -fno-gcc-compatible -Wa,--generate-missing-build-notes=no %s 2>&1 | FileCheck -check-prefix=CHECK-ERROR %s
+// CHECK-ERROR: error: unsupported argument '--generate-missing-build-notes=
+
+int main() {
+    return 1;
+}
-- 
2.33.0

