https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/112820

>From 53683a8543bb6a558a778dc1cc15adb3180df7e4 Mon Sep 17 00:00:00 2001
From: Jinsong Ji <jinsong...@intel.com>
Date: Fri, 18 Oct 2024 05:23:19 +0200
Subject: [PATCH 1/2] [NFC] clang add DiagnosticsTestHelper decl
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by 
GCC 11.

Fix warning

llvm-project/clang/unittests/Basic/DiagnosticTest.cpp:19:6: error: ‘void 
clang::DiagnosticsTestHelper(clang::DiagnosticsEngine&)’ has not been declared 
within ‘clang’ [-Werror]
   19 | void clang::DiagnosticsTestHelper(DiagnosticsEngine &diag) {
      |      ^~~~~
In file included from 
/iusers/jinsongj/llvm-project/clang/unittests/Basic/DiagnosticTest.cpp:9:
/iusers/jinsongj/llvm-project/clang/include/clang/Basic/Diagnostic.h:567:15: 
note: only here as a ‘friend’
  567 |   friend void DiagnosticsTestHelper(DiagnosticsEngine &);
---
 clang/include/clang/Basic/Diagnostic.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/include/clang/Basic/Diagnostic.h 
b/clang/include/clang/Basic/Diagnostic.h
index 3b1efdb12824c7..3f6e85634c3cf5 100644
--- a/clang/include/clang/Basic/Diagnostic.h
+++ b/clang/include/clang/Basic/Diagnostic.h
@@ -1024,6 +1024,8 @@ class DiagnosticsEngine : public 
RefCountedBase<DiagnosticsEngine> {
   /// @}
 };
 
+void DiagnosticsTestHelper(DiagnosticsEngine &);
+
 /// RAII class that determines when any errors have occurred
 /// between the time the instance was created and the time it was
 /// queried.

>From 677dab12a67b801dd0406e38f092f89b71045785 Mon Sep 17 00:00:00 2001
From: Jinsong Ji <jinsong...@intel.com>
Date: Fri, 18 Oct 2024 14:54:56 +0200
Subject: [PATCH 2/2] Add comments

---
 clang/include/clang/Basic/Diagnostic.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/include/clang/Basic/Diagnostic.h 
b/clang/include/clang/Basic/Diagnostic.h
index 3f6e85634c3cf5..dc7e49beb9a0f4 100644
--- a/clang/include/clang/Basic/Diagnostic.h
+++ b/clang/include/clang/Basic/Diagnostic.h
@@ -1024,6 +1024,7 @@ class DiagnosticsEngine : public 
RefCountedBase<DiagnosticsEngine> {
   /// @}
 };
 
+/// Declare the friend function for testing to avoid GCC warning.
 void DiagnosticsTestHelper(DiagnosticsEngine &);
 
 /// RAII class that determines when any errors have occurred

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to