[llvm] [FileCheck][NFC] Encapsulate more into InputAnnotationLabeler (PR #207484)
Joel E. Denny via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 6 21:57:07 PDT 2026
================
@@ -427,63 +427,84 @@ static std::string GetCheckTypeAbbreviation(Check::FileCheckType Ty) {
}
namespace {
-/// Stores all information needed to generate \c InputAnnotation labels for a
-/// particular check pattern. Multiple labelers might be constructed for the
-/// same pattern if the pattern has more than one \c MatchResultDiag (e.g., for
-/// a \c CHECK-COUNT-<N> directive or implicit pattern).
+/// Stores all information needed to generate \c InputAnnotation labels.
class InputAnnotationLabeler {
private:
- unsigned *LabelWidthGlobal;
- unsigned *LabelIndexPerPattern;
- std::string LabelPrefix;
+ struct CompareSMLoc {
+ bool operator()(SMLoc LHS, SMLoc RHS) const {
+ return LHS.getPointer() < RHS.getPointer();
+ }
+ };
+
+ const SourceMgr &SM;
+ const unsigned CheckFileBufferID;
+ const std::pair<unsigned, unsigned> ImpPatBufferIDRange;
+
+ /// How many unique input annotation labels does each check pattern need?
+ /// Each check pattern can have multiple \c MatchResultDiag's, each followed
+ /// by a series of zero or more \c MatchNoteDiag's. Each such
+ /// \c MatchResultDiag and its \c MatchNoteDiag series can require multiple
+ /// labels.
+ std::map<SMLoc, unsigned, CompareSMLoc> LabelCountPerPattern;
----------------
jdenny-ornl wrote:
Thanks. Done.
Does the docs' statement about [special marker values](https://llvm.org/docs/ProgrammersManual.html#llvm-adt-densemap-h) need to be updated?
https://github.com/llvm/llvm-project/pull/207484
More information about the llvm-commits
mailing list