Skip to content

Commit b7df533

Browse files
vitalybukatopperc
andauthored
[NFC][SpecialCaseList] Rename SpecialCaseList::inSectionBlame and move into Section (#162390)
Co-authored-by: Craig Topper <[email protected]>
1 parent abc8aac commit b7df533

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

clang/lib/Basic/SanitizerSpecialCaseList.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ SanitizerSpecialCaseList::inSectionBlame(SanitizerMask Mask, StringRef Prefix,
6666
StringRef Category) const {
6767
for (const auto &S : llvm::reverse(SanitizerSections)) {
6868
if (S.Mask & Mask) {
69-
unsigned LineNum =
70-
SpecialCaseList::inSectionBlame(S.S.Entries, Prefix, Query, Category);
69+
unsigned LineNum = S.S.getLastMatch(Prefix, Query, Category);
7170
if (LineNum > 0)
7271
return {S.S.FileIdx, LineNum};
7372
}

llvm/include/llvm/Support/SpecialCaseList.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ class SpecialCaseList {
153153
SectionEntries Entries;
154154
std::string SectionStr;
155155
unsigned FileIdx;
156+
157+
// Helper method to search by Prefix, Query, and Category. Returns
158+
// 1-based line number on which rule is defined, or 0 if there is no match.
159+
LLVM_ABI unsigned getLastMatch(StringRef Prefix, StringRef Query,
160+
StringRef Category) const;
156161
};
157162

158163
std::vector<Section> Sections;
@@ -164,12 +169,6 @@ class SpecialCaseList {
164169
/// Parses just-constructed SpecialCaseList entries from a memory buffer.
165170
LLVM_ABI bool parse(unsigned FileIdx, const MemoryBuffer *MB,
166171
std::string &Error);
167-
168-
// Helper method for derived classes to search by Prefix, Query, and Category
169-
// once they have already resolved a section entry.
170-
LLVM_ABI unsigned inSectionBlame(const SectionEntries &Entries,
171-
StringRef Prefix, StringRef Query,
172-
StringRef Category) const;
173172
};
174173

175174
} // namespace llvm

llvm/lib/Support/SpecialCaseList.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,17 +228,17 @@ SpecialCaseList::inSectionBlame(StringRef Section, StringRef Prefix,
228228
StringRef Query, StringRef Category) const {
229229
for (const auto &S : reverse(Sections)) {
230230
if (S.SectionMatcher.match(Section)) {
231-
unsigned Blame = inSectionBlame(S.Entries, Prefix, Query, Category);
231+
unsigned Blame = S.getLastMatch(Prefix, Query, Category);
232232
if (Blame)
233233
return {S.FileIdx, Blame};
234234
}
235235
}
236236
return NotFound;
237237
}
238238

239-
unsigned SpecialCaseList::inSectionBlame(const SectionEntries &Entries,
240-
StringRef Prefix, StringRef Query,
241-
StringRef Category) const {
239+
unsigned SpecialCaseList::Section::getLastMatch(StringRef Prefix,
240+
StringRef Query,
241+
StringRef Category) const {
242242
SectionEntries::const_iterator I = Entries.find(Prefix);
243243
if (I == Entries.end())
244244
return 0;

0 commit comments

Comments
 (0)