Skip to content

Conversation

vbvictor
Copy link
Contributor

@vbvictor vbvictor commented Aug 15, 2025

This helps better distinguish warnings that could be disabled via .clang-tidy config (like clang-diagnostic-literal-conversion) from errors that could not be suppressed at all (like clang-diagnostic-error) because it's a hard compiler error.

After #153870 (comment), decided to just add documentation about clang-diagnostic-error

@llvmbot
Copy link
Member

llvmbot commented Aug 15, 2025

@llvm/pr-subscribers-clang-tools-extra

Author: Baranov Victor (vbvictor)

Changes

This helps better distinguish warnings that could be disabled via .clang-tidy config (like clang-diagnostic-literal-conversion) from errors that could not be suppressed at all (like clang-diagnostic-error) because it's a hard compiler error.


Full diff: https://github.com/llvm/llvm-project/pull/153870.diff

17 Files Affected:

  • (modified) clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp (+4-4)
  • (modified) clang-tools-extra/docs/ReleaseNotes.rst (+4)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-invalid-decl-no-crash.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-no-crash.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone-unknown-expr.cpp (+3-3)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-semicolon-fail.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-member-init-no-crash.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/misc/misplaced-const-cxx17.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls-errors.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/modernize/use-noexcept-error.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp (+2-2)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-incomplete-type.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/readability/isolate-declaration-no-infinite-loop.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp (+7-7)
  • (modified) clang-tools-extra/test/clang-tidy/infrastructure/export-diagnostics.cpp (+6-6)
  • (modified) clang-tools-extra/test/clang-tidy/infrastructure/serialize-diagnostics.cpp (+1-1)
diff --git a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
index fac6e0418d163..34f29a5a953f1 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
@@ -409,16 +409,16 @@ void ClangTidyDiagnosticConsumer::HandleDiagnostic(
       switch (DiagLevel) {
       case DiagnosticsEngine::Error:
       case DiagnosticsEngine::Fatal:
-        CheckName = "clang-diagnostic-error";
+        CheckName = "clang-compiler-error";
         break;
       case DiagnosticsEngine::Warning:
-        CheckName = "clang-diagnostic-warning";
+        CheckName = "clang-compiler-warning";
         break;
       case DiagnosticsEngine::Remark:
-        CheckName = "clang-diagnostic-remark";
+        CheckName = "clang-compiler-remark";
         break;
       default:
-        CheckName = "clang-diagnostic-unknown";
+        CheckName = "clang-compiler-unknown";
         break;
       }
     }
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index 8b63601882930..14f2ec88b3881 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -109,6 +109,10 @@ Improvements to clang-tidy
   `enable-check-profile` to enable per-check timing profiles and print a
   report based on all analyzed files.
 
+- Improved :program:`clang-tidy` by renaming ``clang-diagnostic-error``
+  diagnostic to ``clang-compiler-error`` to better distinguish :program:`clang`
+  hard compiler errors from diagnostics coming from compiler flags.
+
 New checks
 ^^^^^^^^^^
 
diff --git a/clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-invalid-decl-no-crash.cpp b/clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-invalid-decl-no-crash.cpp
index 5688c03ca0e16..342adbc0910aa 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-invalid-decl-no-crash.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-invalid-decl-no-crash.cpp
@@ -3,4 +3,4 @@
 struct Foo {
   member; // no-crash
 };
-// CHECK-MESSAGES: :[[@LINE-2]]:3: error: a type specifier is required for all declarations [clang-diagnostic-error]
+// CHECK-MESSAGES: :[[@LINE-2]]:3: error: a type specifier is required for all declarations [clang-compiler-error]
diff --git a/clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-no-crash.cpp b/clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-no-crash.cpp
index 660addcbe8039..e4e819e25444b 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-no-crash.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-no-crash.cpp
@@ -3,5 +3,5 @@
 struct A;
 struct B {
   A a;
-// CHECK-MESSAGES: :[[@LINE-1]]:5: error: field has incomplete type 'A' [clang-diagnostic-error]
+// CHECK-MESSAGES: :[[@LINE-1]]:5: error: field has incomplete type 'A' [clang-compiler-error]
 };
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone-unknown-expr.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone-unknown-expr.cpp
index d2641523750c9..2fcb490bea094 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone-unknown-expr.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone-unknown-expr.cpp
@@ -1,9 +1,9 @@
 // RUN: %check_clang_tidy -expect-clang-tidy-error %s bugprone-branch-clone %t
 
 int test_unknown_expression() {
-  if (unknown_expression_1) {        // CHECK-MESSAGES: :[[@LINE]]:7: error: use of undeclared identifier 'unknown_expression_1' [clang-diagnostic-error]
-    function1(unknown_expression_2); // CHECK-MESSAGES: :[[@LINE]]:15: error: use of undeclared identifier 'unknown_expression_2' [clang-diagnostic-error]
+  if (unknown_expression_1) {        // CHECK-MESSAGES: :[[@LINE]]:7: error: use of undeclared identifier 'unknown_expression_1' [clang-compiler-error]
+    function1(unknown_expression_2); // CHECK-MESSAGES: :[[@LINE]]:15: error: use of undeclared identifier 'unknown_expression_2' [clang-compiler-error]
   } else {
-    function2(unknown_expression_3); // CHECK-MESSAGES: :[[@LINE]]:15: error: use of undeclared identifier 'unknown_expression_3' [clang-diagnostic-error]
+    function2(unknown_expression_3); // CHECK-MESSAGES: :[[@LINE]]:15: error: use of undeclared identifier 'unknown_expression_3' [clang-compiler-error]
   }
 }
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-semicolon-fail.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-semicolon-fail.cpp
index 45fa2262f6de7..0768682585873 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-semicolon-fail.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-semicolon-fail.cpp
@@ -18,7 +18,7 @@ void f() {
   // CHECK-WERROR: :[[@LINE-1]]:11: warning: potentially unintended semicolon [bugprone-suspicious-semicolon]
 #if ERROR
   int a
-  // CHECK-ERROR: :[[@LINE-1]]:8: error: expected ';' at end of declaration [clang-diagnostic-error]
+  // CHECK-ERROR: :[[@LINE-1]]:8: error: expected ';' at end of declaration [clang-compiler-error]
 #elif WERROR
   int a;
   // CHECK-WERROR: :[[@LINE-1]]:7: error: unused variable 'a' [clang-diagnostic-unused-variable]
diff --git a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp
index 824431c1bf52f..966d314d2b6d0 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp
@@ -131,7 +131,7 @@ void test_clang_diagnostic_error() {
   // CHECK-FIXES: {{^}}  int a = 0;{{$}}
 
   UnknownType b;
-  // CHECK-MESSAGES: :[[@LINE-1]]:3: error: unknown type name 'UnknownType' [clang-diagnostic-error]
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: error: unknown type name 'UnknownType' [clang-compiler-error]
   // CHECK-FIXES-NOT: {{^}}  UnknownType b = 0;{{$}}
 }
 
diff --git a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-member-init-no-crash.cpp b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-member-init-no-crash.cpp
index 2e2964dda1daf..b4a063599fcf0 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-member-init-no-crash.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-member-init-no-crash.cpp
@@ -2,7 +2,7 @@
 
 struct X {
   X x;
-  // CHECK-MESSAGES: :[[@LINE-1]]:5: error: field has incomplete type 'X' [clang-diagnostic-error]
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: error: field has incomplete type 'X' [clang-compiler-error]
   int a = 10;
 };
 
diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/misplaced-const-cxx17.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/misplaced-const-cxx17.cpp
index 7816a091d7adb..c2a3a59504d70 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc/misplaced-const-cxx17.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/misplaced-const-cxx17.cpp
@@ -3,7 +3,7 @@
 // This test previously would cause a failed assertion because the structured
 // binding declaration had no valid type associated with it. This ensures the
 // expected clang diagnostic is generated instead.
-// CHECK-MESSAGES: :[[@LINE+1]]:6: error: decomposition declaration '[x]' requires an initializer [clang-diagnostic-error]
+// CHECK-MESSAGES: :[[@LINE+1]]:6: error: decomposition declaration '[x]' requires an initializer [clang-compiler-error]
 auto [x];
 
 struct S { int a; };
diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls-errors.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls-errors.cpp
index 1c26a6961aad2..9b4fede68ace2 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls-errors.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls-errors.cpp
@@ -8,5 +8,5 @@ using n::C;
 
 void f() {
   for (C *p : unknown()) {}
-  // CHECK-MESSAGES: :[[@LINE-1]]:15: error: use of undeclared identifier 'unknown' [clang-diagnostic-error]
+  // CHECK-MESSAGES: :[[@LINE-1]]:15: error: use of undeclared identifier 'unknown' [clang-compiler-error]
 }
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-noexcept-error.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-noexcept-error.cpp
index 9a80b075d65ed..1065f0cb9a632 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-noexcept-error.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-noexcept-error.cpp
@@ -3,4 +3,4 @@
 // We're not interested in the check issuing a warning here, just making sure
 // clang-tidy doesn't assert.
 undefined_type doesThrow() throw();
-// CHECK-MESSAGES: :[[@LINE-1]]:1: error: unknown type name 'undefined_type' [clang-diagnostic-error]
+// CHECK-MESSAGES: :[[@LINE-1]]:1: error: unknown type name 'undefined_type' [clang-compiler-error]
diff --git a/clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp b/clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp
index 4df0927b62af5..994e0a3509e06 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp
@@ -408,8 +408,8 @@ template <typename value_type> class set {
 
 #ifdef ENABLE_ERROR
   set(initializer_list<value_type> __l) {};
-  // CHECK-MESSAGES-ERR: :[[@LINE-1]]:7: error: member 'initializer_list' cannot have template arguments [clang-diagnostic-error]
-  // CHECK-MESSAGES-ERR: :[[@LINE-2]]:36: error: expected ')' [clang-diagnostic-error]
+  // CHECK-MESSAGES-ERR: :[[@LINE-1]]:7: error: member 'initializer_list' cannot have template arguments [clang-compiler-error]
+  // CHECK-MESSAGES-ERR: :[[@LINE-2]]:36: error: expected ')' [clang-compiler-error]
 #endif
 };
 
diff --git a/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-incomplete-type.cpp b/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-incomplete-type.cpp
index e46163a3e2315..f626093ff0e30 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-incomplete-type.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-incomplete-type.cpp
@@ -4,6 +4,6 @@
 // clang-tidy diagnostic about IncompleteType being expensive to copy.
 struct IncompleteType;
 void NegativeForIncompleteType(IncompleteType I) {
-  // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type 'IncompleteType' [clang-diagnostic-error]
+  // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type 'IncompleteType' [clang-compiler-error]
 }
 
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/isolate-declaration-no-infinite-loop.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/isolate-declaration-no-infinite-loop.cpp
index 78a8ec738800e..908d0c57523b5 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/isolate-declaration-no-infinite-loop.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/isolate-declaration-no-infinite-loop.cpp
@@ -3,5 +3,5 @@
 int main(){
   int a, b
   // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
-  // CHECK-MESSAGES: [[@LINE-2]]:11: error: expected ';' at end of declaration [clang-diagnostic-error]
+  // CHECK-MESSAGES: [[@LINE-2]]:11: error: expected ';' at end of declaration [clang-compiler-error]
 }
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp
index a9d140bc9318e..5fb0d45784831 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp
@@ -27,12 +27,12 @@
 // RUN: clang-tidy -checks='-*,modernize-use-override,clang-diagnostic-macro-redefined,clang-diagnostic-literal-conversion' %s -- -DMACRO_FROM_COMMAND_LINE -std=c++20 -Wno-macro-redefined | FileCheck --check-prefix=CHECK7 -implicit-check-not='{{warning:|error:}}' %s
 // RUN: clang-tidy -checks='-*,modernize-use-override' %s -- -std=c++20 -DPR64602
 
-// CHECK1: error: no input files [clang-diagnostic-error]
-// CHECK1: error: no such file or directory: '{{.*}}nonexistent.cpp' [clang-diagnostic-error]
-// CHECK1: error: unable to handle compilation{{.*}} [clang-diagnostic-error]
-// CHECK2: error: unknown argument: '-fan-unknown-option' [clang-diagnostic-error]
-// CHECK3: error: unknown argument: '-fan-unknown-option' [clang-diagnostic-error]
-// CHECK5: error: unknown argument: '-fan-option-from-compilation-database' [clang-diagnostic-error]
+// CHECK1: error: no input files [clang-compiler-error]
+// CHECK1: error: no such file or directory: '{{.*}}nonexistent.cpp' [clang-compiler-error]
+// CHECK1: error: unable to handle compilation{{.*}} [clang-compiler-error]
+// CHECK2: error: unknown argument: '-fan-unknown-option' [clang-compiler-error]
+// CHECK3: error: unknown argument: '-fan-unknown-option' [clang-compiler-error]
+// CHECK5: error: unknown argument: '-fan-option-from-compilation-database' [clang-compiler-error]
 
 // CHECK7: :[[@LINE+4]]:9: warning: implicit conversion from 'double' to 'int' changes value from 1.5 to 1 [clang-diagnostic-literal-conversion]
 // CHECK2: :[[@LINE+3]]:9: warning: implicit conversion from 'double' to 'int' changes value from 1.5 to 1 [clang-diagnostic-literal-conversion]
@@ -52,7 +52,7 @@ class A { A(int) {} };
 #ifdef COMPILATION_ERROR
 void f(int a) {
   &(a + 1);
-  // CHECK6: :[[@LINE-1]]:3: error: cannot take the address of an rvalue of type 'int' [clang-diagnostic-error]
+  // CHECK6: :[[@LINE-1]]:3: error: cannot take the address of an rvalue of type 'int' [clang-compiler-error]
 }
 #endif
 
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/export-diagnostics.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/export-diagnostics.cpp
index ca2184332f9a4..fa41d471ab7a1 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/export-diagnostics.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/export-diagnostics.cpp
@@ -18,10 +18,10 @@ struct Foo {
 // CHECK-MESSAGES: {{^}}note: expanded from here{{$}}
 // CHECK-MESSAGES: -input.cpp:2:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
 // CHECK-MESSAGES: -input.cpp:1:14: note: expanded from macro 'X'
-// CHECK-MESSAGES: -input.cpp:3:7: error: 'a' declared as an array with a negative size [clang-diagnostic-error]
+// CHECK-MESSAGES: -input.cpp:3:7: error: 'a' declared as an array with a negative size [clang-compiler-error]
 // CHECK-MESSAGES: -input.cpp:4:7: warning: zero size arrays are an extension [clang-diagnostic-zero-length-array]
-// CHECK-MESSAGES: -input.cpp:6:11: error: unknown type name 'x' [clang-diagnostic-error]
-// CHECK-MESSAGES: -input.cpp:8:3: error: a type specifier is required for all declarations [clang-diagnostic-error]
+// CHECK-MESSAGES: -input.cpp:6:11: error: unknown type name 'x' [clang-compiler-error]
+// CHECK-MESSAGES: -input.cpp:8:3: error: a type specifier is required for all declarations [clang-compiler-error]
 // CHECK-MESSAGES: -input.cpp:9:3: error: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor,-warnings-as-errors]
 
 // CHECK-YAML: ---
@@ -56,7 +56,7 @@ struct Foo {
 // CHECK-YAML-NEXT:         Replacements:    []
 // CHECK-YAML-NEXT:     Level:           Error
 // CHECK-YAML-NEXT:     BuildDirectory:  '{{.*}}'
-// CHECK-YAML-NEXT:   - DiagnosticName:  clang-diagnostic-error
+// CHECK-YAML-NEXT:   - DiagnosticName:  clang-compiler-error
 // CHECK-YAML-NEXT:     DiagnosticMessage:
 // CHECK-YAML-NEXT:       Message:         '''a'' declared as an array with a negative size'
 // CHECK-YAML-NEXT:       FilePath:        '{{.*}}-input.cpp'
@@ -80,7 +80,7 @@ struct Foo {
 // CHECK-YAML-NEXT:          Length:          1
 // CHECK-YAML-NEXT:     Level:           Warning
 // CHECK-YAML-NEXT:     BuildDirectory:  '{{.*}}'
-// CHECK-YAML-NEXT:   - DiagnosticName:  clang-diagnostic-error
+// CHECK-YAML-NEXT:   - DiagnosticName:  clang-compiler-error
 // CHECK-YAML-NEXT:     DiagnosticMessage:
 // CHECK-YAML-NEXT:       Message:         'unknown type name ''x'''
 // CHECK-YAML-NEXT:       FilePath:        '{{.*}}-input.cpp'
@@ -88,7 +88,7 @@ struct Foo {
 // CHECK-YAML-NEXT:       Replacements:    []
 // CHECK-YAML-NEXT:     Level:           Error
 // CHECK-YAML-NEXT:     BuildDirectory:  '{{.*}}'
-// CHECK-YAML-NEXT:   - DiagnosticName:  clang-diagnostic-error
+// CHECK-YAML-NEXT:   - DiagnosticName:  clang-compiler-error
 // CHECK-YAML-NEXT:     DiagnosticMessage:
 // CHECK-YAML-NEXT:       Message:         a type specifier is required for all declarations
 // CHECK-YAML-NEXT:       FilePath:        '{{.*}}-input.cpp'
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/serialize-diagnostics.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/serialize-diagnostics.cpp
index 8b0895af795a0..4bdcef722a3ed 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/serialize-diagnostics.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/serialize-diagnostics.cpp
@@ -1,3 +1,3 @@
 // RUN: not clang-tidy -checks=-*,llvm-namespace-comment %s -- -serialize-diagnostics %t | FileCheck %s
-// CHECK: :[[@LINE+1]]:12: error: expected ';' after struct [clang-diagnostic-error]
+// CHECK: :[[@LINE+1]]:12: error: expected ';' after struct [clang-compiler-error]
 struct A {}

@llvmbot
Copy link
Member

llvmbot commented Aug 15, 2025

@llvm/pr-subscribers-clang-tidy

Author: Baranov Victor (vbvictor)

Changes

This helps better distinguish warnings that could be disabled via .clang-tidy config (like clang-diagnostic-literal-conversion) from errors that could not be suppressed at all (like clang-diagnostic-error) because it's a hard compiler error.


Full diff: https://github.com/llvm/llvm-project/pull/153870.diff

17 Files Affected:

  • (modified) clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp (+4-4)
  • (modified) clang-tools-extra/docs/ReleaseNotes.rst (+4)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-invalid-decl-no-crash.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-no-crash.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone-unknown-expr.cpp (+3-3)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-semicolon-fail.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-member-init-no-crash.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/misc/misplaced-const-cxx17.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls-errors.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/modernize/use-noexcept-error.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp (+2-2)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-incomplete-type.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/readability/isolate-declaration-no-infinite-loop.cpp (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp (+7-7)
  • (modified) clang-tools-extra/test/clang-tidy/infrastructure/export-diagnostics.cpp (+6-6)
  • (modified) clang-tools-extra/test/clang-tidy/infrastructure/serialize-diagnostics.cpp (+1-1)
diff --git a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
index fac6e0418d163..34f29a5a953f1 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
@@ -409,16 +409,16 @@ void ClangTidyDiagnosticConsumer::HandleDiagnostic(
       switch (DiagLevel) {
       case DiagnosticsEngine::Error:
       case DiagnosticsEngine::Fatal:
-        CheckName = "clang-diagnostic-error";
+        CheckName = "clang-compiler-error";
         break;
       case DiagnosticsEngine::Warning:
-        CheckName = "clang-diagnostic-warning";
+        CheckName = "clang-compiler-warning";
         break;
       case DiagnosticsEngine::Remark:
-        CheckName = "clang-diagnostic-remark";
+        CheckName = "clang-compiler-remark";
         break;
       default:
-        CheckName = "clang-diagnostic-unknown";
+        CheckName = "clang-compiler-unknown";
         break;
       }
     }
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index 8b63601882930..14f2ec88b3881 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -109,6 +109,10 @@ Improvements to clang-tidy
   `enable-check-profile` to enable per-check timing profiles and print a
   report based on all analyzed files.
 
+- Improved :program:`clang-tidy` by renaming ``clang-diagnostic-error``
+  diagnostic to ``clang-compiler-error`` to better distinguish :program:`clang`
+  hard compiler errors from diagnostics coming from compiler flags.
+
 New checks
 ^^^^^^^^^^
 
diff --git a/clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-invalid-decl-no-crash.cpp b/clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-invalid-decl-no-crash.cpp
index 5688c03ca0e16..342adbc0910aa 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-invalid-decl-no-crash.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-invalid-decl-no-crash.cpp
@@ -3,4 +3,4 @@
 struct Foo {
   member; // no-crash
 };
-// CHECK-MESSAGES: :[[@LINE-2]]:3: error: a type specifier is required for all declarations [clang-diagnostic-error]
+// CHECK-MESSAGES: :[[@LINE-2]]:3: error: a type specifier is required for all declarations [clang-compiler-error]
diff --git a/clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-no-crash.cpp b/clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-no-crash.cpp
index 660addcbe8039..e4e819e25444b 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-no-crash.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/altera/struct-pack-align-no-crash.cpp
@@ -3,5 +3,5 @@
 struct A;
 struct B {
   A a;
-// CHECK-MESSAGES: :[[@LINE-1]]:5: error: field has incomplete type 'A' [clang-diagnostic-error]
+// CHECK-MESSAGES: :[[@LINE-1]]:5: error: field has incomplete type 'A' [clang-compiler-error]
 };
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone-unknown-expr.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone-unknown-expr.cpp
index d2641523750c9..2fcb490bea094 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone-unknown-expr.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone-unknown-expr.cpp
@@ -1,9 +1,9 @@
 // RUN: %check_clang_tidy -expect-clang-tidy-error %s bugprone-branch-clone %t
 
 int test_unknown_expression() {
-  if (unknown_expression_1) {        // CHECK-MESSAGES: :[[@LINE]]:7: error: use of undeclared identifier 'unknown_expression_1' [clang-diagnostic-error]
-    function1(unknown_expression_2); // CHECK-MESSAGES: :[[@LINE]]:15: error: use of undeclared identifier 'unknown_expression_2' [clang-diagnostic-error]
+  if (unknown_expression_1) {        // CHECK-MESSAGES: :[[@LINE]]:7: error: use of undeclared identifier 'unknown_expression_1' [clang-compiler-error]
+    function1(unknown_expression_2); // CHECK-MESSAGES: :[[@LINE]]:15: error: use of undeclared identifier 'unknown_expression_2' [clang-compiler-error]
   } else {
-    function2(unknown_expression_3); // CHECK-MESSAGES: :[[@LINE]]:15: error: use of undeclared identifier 'unknown_expression_3' [clang-diagnostic-error]
+    function2(unknown_expression_3); // CHECK-MESSAGES: :[[@LINE]]:15: error: use of undeclared identifier 'unknown_expression_3' [clang-compiler-error]
   }
 }
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-semicolon-fail.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-semicolon-fail.cpp
index 45fa2262f6de7..0768682585873 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-semicolon-fail.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-semicolon-fail.cpp
@@ -18,7 +18,7 @@ void f() {
   // CHECK-WERROR: :[[@LINE-1]]:11: warning: potentially unintended semicolon [bugprone-suspicious-semicolon]
 #if ERROR
   int a
-  // CHECK-ERROR: :[[@LINE-1]]:8: error: expected ';' at end of declaration [clang-diagnostic-error]
+  // CHECK-ERROR: :[[@LINE-1]]:8: error: expected ';' at end of declaration [clang-compiler-error]
 #elif WERROR
   int a;
   // CHECK-WERROR: :[[@LINE-1]]:7: error: unused variable 'a' [clang-diagnostic-unused-variable]
diff --git a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp
index 824431c1bf52f..966d314d2b6d0 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp
@@ -131,7 +131,7 @@ void test_clang_diagnostic_error() {
   // CHECK-FIXES: {{^}}  int a = 0;{{$}}
 
   UnknownType b;
-  // CHECK-MESSAGES: :[[@LINE-1]]:3: error: unknown type name 'UnknownType' [clang-diagnostic-error]
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: error: unknown type name 'UnknownType' [clang-compiler-error]
   // CHECK-FIXES-NOT: {{^}}  UnknownType b = 0;{{$}}
 }
 
diff --git a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-member-init-no-crash.cpp b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-member-init-no-crash.cpp
index 2e2964dda1daf..b4a063599fcf0 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-member-init-no-crash.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-member-init-no-crash.cpp
@@ -2,7 +2,7 @@
 
 struct X {
   X x;
-  // CHECK-MESSAGES: :[[@LINE-1]]:5: error: field has incomplete type 'X' [clang-diagnostic-error]
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: error: field has incomplete type 'X' [clang-compiler-error]
   int a = 10;
 };
 
diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/misplaced-const-cxx17.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/misplaced-const-cxx17.cpp
index 7816a091d7adb..c2a3a59504d70 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc/misplaced-const-cxx17.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/misplaced-const-cxx17.cpp
@@ -3,7 +3,7 @@
 // This test previously would cause a failed assertion because the structured
 // binding declaration had no valid type associated with it. This ensures the
 // expected clang diagnostic is generated instead.
-// CHECK-MESSAGES: :[[@LINE+1]]:6: error: decomposition declaration '[x]' requires an initializer [clang-diagnostic-error]
+// CHECK-MESSAGES: :[[@LINE+1]]:6: error: decomposition declaration '[x]' requires an initializer [clang-compiler-error]
 auto [x];
 
 struct S { int a; };
diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls-errors.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls-errors.cpp
index 1c26a6961aad2..9b4fede68ace2 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls-errors.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls-errors.cpp
@@ -8,5 +8,5 @@ using n::C;
 
 void f() {
   for (C *p : unknown()) {}
-  // CHECK-MESSAGES: :[[@LINE-1]]:15: error: use of undeclared identifier 'unknown' [clang-diagnostic-error]
+  // CHECK-MESSAGES: :[[@LINE-1]]:15: error: use of undeclared identifier 'unknown' [clang-compiler-error]
 }
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-noexcept-error.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-noexcept-error.cpp
index 9a80b075d65ed..1065f0cb9a632 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-noexcept-error.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-noexcept-error.cpp
@@ -3,4 +3,4 @@
 // We're not interested in the check issuing a warning here, just making sure
 // clang-tidy doesn't assert.
 undefined_type doesThrow() throw();
-// CHECK-MESSAGES: :[[@LINE-1]]:1: error: unknown type name 'undefined_type' [clang-diagnostic-error]
+// CHECK-MESSAGES: :[[@LINE-1]]:1: error: unknown type name 'undefined_type' [clang-compiler-error]
diff --git a/clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp b/clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp
index 4df0927b62af5..994e0a3509e06 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp
@@ -408,8 +408,8 @@ template <typename value_type> class set {
 
 #ifdef ENABLE_ERROR
   set(initializer_list<value_type> __l) {};
-  // CHECK-MESSAGES-ERR: :[[@LINE-1]]:7: error: member 'initializer_list' cannot have template arguments [clang-diagnostic-error]
-  // CHECK-MESSAGES-ERR: :[[@LINE-2]]:36: error: expected ')' [clang-diagnostic-error]
+  // CHECK-MESSAGES-ERR: :[[@LINE-1]]:7: error: member 'initializer_list' cannot have template arguments [clang-compiler-error]
+  // CHECK-MESSAGES-ERR: :[[@LINE-2]]:36: error: expected ')' [clang-compiler-error]
 #endif
 };
 
diff --git a/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-incomplete-type.cpp b/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-incomplete-type.cpp
index e46163a3e2315..f626093ff0e30 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-incomplete-type.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-incomplete-type.cpp
@@ -4,6 +4,6 @@
 // clang-tidy diagnostic about IncompleteType being expensive to copy.
 struct IncompleteType;
 void NegativeForIncompleteType(IncompleteType I) {
-  // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type 'IncompleteType' [clang-diagnostic-error]
+  // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type 'IncompleteType' [clang-compiler-error]
 }
 
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/isolate-declaration-no-infinite-loop.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/isolate-declaration-no-infinite-loop.cpp
index 78a8ec738800e..908d0c57523b5 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/isolate-declaration-no-infinite-loop.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/isolate-declaration-no-infinite-loop.cpp
@@ -3,5 +3,5 @@
 int main(){
   int a, b
   // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
-  // CHECK-MESSAGES: [[@LINE-2]]:11: error: expected ';' at end of declaration [clang-diagnostic-error]
+  // CHECK-MESSAGES: [[@LINE-2]]:11: error: expected ';' at end of declaration [clang-compiler-error]
 }
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp
index a9d140bc9318e..5fb0d45784831 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp
@@ -27,12 +27,12 @@
 // RUN: clang-tidy -checks='-*,modernize-use-override,clang-diagnostic-macro-redefined,clang-diagnostic-literal-conversion' %s -- -DMACRO_FROM_COMMAND_LINE -std=c++20 -Wno-macro-redefined | FileCheck --check-prefix=CHECK7 -implicit-check-not='{{warning:|error:}}' %s
 // RUN: clang-tidy -checks='-*,modernize-use-override' %s -- -std=c++20 -DPR64602
 
-// CHECK1: error: no input files [clang-diagnostic-error]
-// CHECK1: error: no such file or directory: '{{.*}}nonexistent.cpp' [clang-diagnostic-error]
-// CHECK1: error: unable to handle compilation{{.*}} [clang-diagnostic-error]
-// CHECK2: error: unknown argument: '-fan-unknown-option' [clang-diagnostic-error]
-// CHECK3: error: unknown argument: '-fan-unknown-option' [clang-diagnostic-error]
-// CHECK5: error: unknown argument: '-fan-option-from-compilation-database' [clang-diagnostic-error]
+// CHECK1: error: no input files [clang-compiler-error]
+// CHECK1: error: no such file or directory: '{{.*}}nonexistent.cpp' [clang-compiler-error]
+// CHECK1: error: unable to handle compilation{{.*}} [clang-compiler-error]
+// CHECK2: error: unknown argument: '-fan-unknown-option' [clang-compiler-error]
+// CHECK3: error: unknown argument: '-fan-unknown-option' [clang-compiler-error]
+// CHECK5: error: unknown argument: '-fan-option-from-compilation-database' [clang-compiler-error]
 
 // CHECK7: :[[@LINE+4]]:9: warning: implicit conversion from 'double' to 'int' changes value from 1.5 to 1 [clang-diagnostic-literal-conversion]
 // CHECK2: :[[@LINE+3]]:9: warning: implicit conversion from 'double' to 'int' changes value from 1.5 to 1 [clang-diagnostic-literal-conversion]
@@ -52,7 +52,7 @@ class A { A(int) {} };
 #ifdef COMPILATION_ERROR
 void f(int a) {
   &(a + 1);
-  // CHECK6: :[[@LINE-1]]:3: error: cannot take the address of an rvalue of type 'int' [clang-diagnostic-error]
+  // CHECK6: :[[@LINE-1]]:3: error: cannot take the address of an rvalue of type 'int' [clang-compiler-error]
 }
 #endif
 
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/export-diagnostics.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/export-diagnostics.cpp
index ca2184332f9a4..fa41d471ab7a1 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/export-diagnostics.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/export-diagnostics.cpp
@@ -18,10 +18,10 @@ struct Foo {
 // CHECK-MESSAGES: {{^}}note: expanded from here{{$}}
 // CHECK-MESSAGES: -input.cpp:2:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
 // CHECK-MESSAGES: -input.cpp:1:14: note: expanded from macro 'X'
-// CHECK-MESSAGES: -input.cpp:3:7: error: 'a' declared as an array with a negative size [clang-diagnostic-error]
+// CHECK-MESSAGES: -input.cpp:3:7: error: 'a' declared as an array with a negative size [clang-compiler-error]
 // CHECK-MESSAGES: -input.cpp:4:7: warning: zero size arrays are an extension [clang-diagnostic-zero-length-array]
-// CHECK-MESSAGES: -input.cpp:6:11: error: unknown type name 'x' [clang-diagnostic-error]
-// CHECK-MESSAGES: -input.cpp:8:3: error: a type specifier is required for all declarations [clang-diagnostic-error]
+// CHECK-MESSAGES: -input.cpp:6:11: error: unknown type name 'x' [clang-compiler-error]
+// CHECK-MESSAGES: -input.cpp:8:3: error: a type specifier is required for all declarations [clang-compiler-error]
 // CHECK-MESSAGES: -input.cpp:9:3: error: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor,-warnings-as-errors]
 
 // CHECK-YAML: ---
@@ -56,7 +56,7 @@ struct Foo {
 // CHECK-YAML-NEXT:         Replacements:    []
 // CHECK-YAML-NEXT:     Level:           Error
 // CHECK-YAML-NEXT:     BuildDirectory:  '{{.*}}'
-// CHECK-YAML-NEXT:   - DiagnosticName:  clang-diagnostic-error
+// CHECK-YAML-NEXT:   - DiagnosticName:  clang-compiler-error
 // CHECK-YAML-NEXT:     DiagnosticMessage:
 // CHECK-YAML-NEXT:       Message:         '''a'' declared as an array with a negative size'
 // CHECK-YAML-NEXT:       FilePath:        '{{.*}}-input.cpp'
@@ -80,7 +80,7 @@ struct Foo {
 // CHECK-YAML-NEXT:          Length:          1
 // CHECK-YAML-NEXT:     Level:           Warning
 // CHECK-YAML-NEXT:     BuildDirectory:  '{{.*}}'
-// CHECK-YAML-NEXT:   - DiagnosticName:  clang-diagnostic-error
+// CHECK-YAML-NEXT:   - DiagnosticName:  clang-compiler-error
 // CHECK-YAML-NEXT:     DiagnosticMessage:
 // CHECK-YAML-NEXT:       Message:         'unknown type name ''x'''
 // CHECK-YAML-NEXT:       FilePath:        '{{.*}}-input.cpp'
@@ -88,7 +88,7 @@ struct Foo {
 // CHECK-YAML-NEXT:       Replacements:    []
 // CHECK-YAML-NEXT:     Level:           Error
 // CHECK-YAML-NEXT:     BuildDirectory:  '{{.*}}'
-// CHECK-YAML-NEXT:   - DiagnosticName:  clang-diagnostic-error
+// CHECK-YAML-NEXT:   - DiagnosticName:  clang-compiler-error
 // CHECK-YAML-NEXT:     DiagnosticMessage:
 // CHECK-YAML-NEXT:       Message:         a type specifier is required for all declarations
 // CHECK-YAML-NEXT:       FilePath:        '{{.*}}-input.cpp'
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/serialize-diagnostics.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/serialize-diagnostics.cpp
index 8b0895af795a0..4bdcef722a3ed 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/serialize-diagnostics.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/serialize-diagnostics.cpp
@@ -1,3 +1,3 @@
 // RUN: not clang-tidy -checks=-*,llvm-namespace-comment %s -- -serialize-diagnostics %t | FileCheck %s
-// CHECK: :[[@LINE+1]]:12: error: expected ';' after struct [clang-diagnostic-error]
+// CHECK: :[[@LINE+1]]:12: error: expected ';' after struct [clang-compiler-error]
 struct A {}

@vbvictor vbvictor force-pushed the rename-clang-diagnostic-error-to-compiler-error branch from 336c49e to c8e0fa4 Compare August 15, 2025 20:37
@carlosgalvezp
Copy link
Contributor

carlosgalvezp commented Aug 17, 2025

This will be a breaking change for people who post-process the clang-tidy logs in some way and search for clang-diagnostic-error:

https://sourcegraph.com/search?q=context:global+clang-diagnostic-error&patternType=keyword&sm=0

I see hits in scripts from "major" organisations like Mozilla, Jenkins, Sonar, Microsoft, etc. I don't however have a feeling for "how much is too much", whether this breakage is acceptable or not.

Thus I wonder if we should have a smoother transition like typically do with breaking changes, e.g. a 2-release cycle. I also wonder if this renaming is even worth at all, considering the trouble it might give, and if we should instead direct our efforts into documentation, to achieve the same goal: provide clarity to our users.

@vbvictor
Copy link
Contributor Author

vbvictor commented Aug 17, 2025

I also wonder if this renaming is even worth at all, considering the trouble it might give, and if we should instead direct our efforts into documentation, to achieve the same goal: provide clarity to our users.

Thank you for the feedback, given the scale of how clang-diagnostic-error is bound to post-processing I think it's not worth a struggle (for now at least).

@vbvictor vbvictor force-pushed the rename-clang-diagnostic-error-to-compiler-error branch from c8e0fa4 to e4d7203 Compare August 17, 2025 10:45
@vbvictor vbvictor changed the title [clang-tidy] Rename "clang-diagnostic-error" to "clang-compiler-error" [clang-tidy][docs] Add description of "clang-diagnostic-error" Aug 17, 2025
@vbvictor
Copy link
Contributor Author

I've changed PR to just add documentation about clang-diagnostic-error.

Copy link
Contributor

@carlosgalvezp carlosgalvezp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@vbvictor vbvictor merged commit dff8dac into llvm:main Aug 17, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants