[llvm-branch-commits] [llvm] [FileCheck][NFC] Introduce MatchResultDiag and MatchNoteDiag (PR #195569)

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue May 5 00:01:40 PDT 2026


================
@@ -111,24 +112,29 @@ class FileCheckType {
 };
 } // namespace Check
 
-/// Summary of a FileCheck diagnostic.
-struct FileCheckDiag {
-  /// What is the FileCheck directive for this diagnostic?
-  Check::FileCheckType CheckTy;
-  /// Where is the FileCheck directive for this diagnostic?
-  SMLoc CheckLoc;
+class MatchResultDiag;
+
+/// Abstract base class for recording a FileCheck diagnostic for a pattern
+/// (e.g., \c CHECK-NEXT directive or \c --implicit-check-not).
+///
+/// \c FileCheckDiag has two direct derived classes:
+/// - \c MatchResultDiag records a match result for a pattern.  There might be
+///   more than one for a single pattern.  For example, for \c CHECK-DAG there
+///   might be several discarded matches before either a good match or a failure
+///   to match.
+/// - \c MatchNoteDiag provides an additional note about the most recent
+///   \c MatchResultDiag emitted by a FileCheck invocation.  For example, there
+///   might be a fuzzy match after a failure to match.
+class FileCheckDiag {
+public:
+  enum FileCheckDiagKind { FCDK_MatchResultDiag, FCDK_MatchNoteDiag };
----------------
MaskRay wrote:

`FCDK_` prefix is reundant since the enum is nested in the class

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


More information about the llvm-branch-commits mailing list