[clang] [llvm] [clang] Add `-verify-directives` cc1 flag (PR #179835)

Matheus Izvekov via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 27 08:18:17 PST 2026


================
@@ -1044,6 +1146,141 @@ static unsigned CheckResults(DiagnosticsEngine &Diags, SourceManager &SourceMgr,
   return NumProblems;
 }
 
+// Checks that directives are lexically in the same order as the emitted
+// diagnostics. Assumes that:
+//   - every directive matches exactly one diagnostic,
+//   - there are no wildcards, and
+//   - CheckResults returned 0 problems, i.e. every diagnostic
+//     was matched by every directive without considering the order.
+static unsigned CheckResultsAreInOrder(DiagnosticsEngine &Diags,
+                                       SourceManager &SourceMgr,
+                                       const TextDiagnosticBuffer &Buffer,
+                                       const ExpectedData &ED) {
----------------
mizvekov wrote:

What I am saying is that missing / unordered notes can be checked earlier, between the emission of two error or warnings diagnostics, because notes are not produced in isolation like the other diagnostics.

https://github.com/llvm/llvm-project/pull/179835


More information about the llvm-commits mailing list