[llvm] [FileCheck][NFC] Introduce FileCheckDiagList for -dump-input (PR #195568)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun May 3 20:34:54 PDT 2026
================
@@ -174,6 +174,30 @@ struct FileCheckDiag {
StringRef Note = "");
};
+/// A \c FileCheckDiag series emitted by the FileCheck library.
+class FileCheckDiagList {
+private:
+ std::vector<std::unique_ptr<FileCheckDiag>> DiagList;
+
+public:
+ /// Emplace a new \c FileCheckDiag.
+ template <typename... ArgTys> void emplace_back(const ArgTys &...Args) {
+ DiagList.emplace_back(std::make_unique<FileCheckDiag>(Args...));
+ }
+ /// Adjust recent consecutive diagnostics of the same \c CheckLoc to have
+ /// \c MatchTy.
+ void adjustPrevDiags(FileCheckDiag::MatchType MatchTy) {
+ SMLoc CheckLoc = (*DiagList.rbegin())->CheckLoc;
+ for (auto I = DiagList.rbegin(), E = DiagList.rend();
+ I != E && (*I)->CheckLoc == CheckLoc; ++I)
+ (*I)->MatchTy = MatchTy;
+ }
+ /// The \c FileCheckDiag list.
----------------
MaskRay wrote:
This comment is unneeded.
Do you plan to introduce `begin/end/size/operator[]` in the future? Can be added later
https://github.com/llvm/llvm-project/pull/195568
More information about the llvm-commits
mailing list