[clang] [NFC] clang add DiagnosticsTestHelper decl (PR #112820)

Jinsong Ji via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 17 20:24:29 PDT 2024


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

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 &);


>From 53683a8543bb6a558a778dc1cc15adb3180df7e4 Mon Sep 17 00:00:00 2001
From: Jinsong Ji <jinsong.ji at intel.com>
Date: Fri, 18 Oct 2024 05:23:19 +0200
Subject: [PATCH] [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.



More information about the cfe-commits mailing list