[clang] 6a623e8 - [NFC] add DiagnosticsTestHelper decl (#112820)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 18 09:54:02 PDT 2024


Author: Jinsong Ji
Date: 2024-10-18T12:53:59-04:00
New Revision: 6a623e8484fe713d7074acb7ceab520458bfa89c

URL: https://github.com/llvm/llvm-project/commit/6a623e8484fe713d7074acb7ceab520458bfa89c
DIFF: https://github.com/llvm/llvm-project/commit/6a623e8484fe713d7074acb7ceab520458bfa89c.diff

LOG: [NFC] add DiagnosticsTestHelper decl (#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
llvm-project/clang/unittests/Basic/DiagnosticTest.cpp:9:
llvm-project/clang/include/clang/Basic/Diagnostic.h:567:15: note: only
here as a ‘friend’
  567 |   friend void DiagnosticsTestHelper(DiagnosticsEngine &);

Added: 
    

Modified: 
    clang/unittests/Basic/DiagnosticTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Basic/DiagnosticTest.cpp b/clang/unittests/Basic/DiagnosticTest.cpp
index 691d74f697f278..d8d23e3b670097 100644
--- a/clang/unittests/Basic/DiagnosticTest.cpp
+++ b/clang/unittests/Basic/DiagnosticTest.cpp
@@ -16,6 +16,11 @@
 using namespace llvm;
 using namespace clang;
 
+// Declare DiagnosticsTestHelper to avoid GCC warning
+namespace clang {
+void DiagnosticsTestHelper(DiagnosticsEngine &diag);
+}
+
 void clang::DiagnosticsTestHelper(DiagnosticsEngine &diag) {
   EXPECT_FALSE(diag.DiagStates.empty());
   EXPECT_TRUE(diag.DiagStatesByLoc.empty());


        


More information about the cfe-commits mailing list