@@ -195,17 +195,22 @@ class SpecialCaseList {
195195 using SectionEntries = StringMap<StringMap<Matcher>>;
196196
197197protected:
198- struct Section {
198+ class Section {
199+ public:
199200 Section (StringRef Str, unsigned FileIdx, bool UseGlobs)
200201 : SectionMatcher(UseGlobs, /* RemoveDotSlash=*/ false ), SectionStr(Str),
201202 FileIdx (FileIdx) {}
202203
203204 Section (Section &&) = default;
204205
205- Matcher SectionMatcher;
206- SectionEntries Entries;
207- std::string SectionStr;
208- unsigned FileIdx;
206+ // Return name of the section, it's entire string in [].
207+ StringRef name () const { return SectionStr; }
208+
209+ // Returns true of string 'Name' matches section name interpreted as a glob.
210+ LLVM_ABI bool matchName (StringRef Name) const ;
211+
212+ // Return sequence number of the file where this section is defined.
213+ unsigned fileIndex () const { return FileIdx; }
209214
210215 // Helper method to search by Prefix, Query, and Category. Returns
211216 // 1-based line number on which rule is defined, or 0 if there is no match.
@@ -217,11 +222,19 @@ class SpecialCaseList {
217222 LLVM_ABI StringRef getLongestMatch (StringRef Prefix, StringRef Query,
218223 StringRef Category) const ;
219224
225+ // / Returns true if the section has any entries for the given prefix.
226+ LLVM_ABI bool hasPrefix (StringRef Prefix) const ;
227+
220228 private:
221229 friend class SpecialCaseList ;
222230 LLVM_ABI void preprocess (bool OrderBySize);
223231 LLVM_ABI const SpecialCaseList::Matcher *
224232 findMatcher (StringRef Prefix, StringRef Category) const ;
233+
234+ Matcher SectionMatcher;
235+ std::string SectionStr;
236+ SectionEntries Entries;
237+ unsigned FileIdx;
225238 };
226239
227240 ArrayRef<const Section> sections () const { return Sections; }
0 commit comments