-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[NFC][SpecialCaseList] Rename SpecialCaseList::inSectionBlame and move into Section #162390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
vitalybuka
merged 4 commits into
main
from
users/vitalybuka/spr/nfcspecialcaselist-rename-specialcaselistinsectionblame-and-move-into-section
Oct 7, 2025
Merged
[NFC][SpecialCaseList] Rename SpecialCaseList::inSectionBlame and move into Section #162390
vitalybuka
merged 4 commits into
main
from
users/vitalybuka/spr/nfcspecialcaselist-rename-specialcaselistinsectionblame-and-move-into-section
Oct 7, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Created using spr 1.3.6 [skip ci]
Created using spr 1.3.6
@llvm/pr-subscribers-llvm-support @llvm/pr-subscribers-clang Author: Vitaly Buka (vitalybuka) ChangesFull diff: https://github.com/llvm/llvm-project/pull/162390.diff 3 Files Affected:
diff --git a/clang/lib/Basic/SanitizerSpecialCaseList.cpp b/clang/lib/Basic/SanitizerSpecialCaseList.cpp
index d8ccc50a8561e..a1dc4a7ec99bf 100644
--- a/clang/lib/Basic/SanitizerSpecialCaseList.cpp
+++ b/clang/lib/Basic/SanitizerSpecialCaseList.cpp
@@ -66,8 +66,7 @@ SanitizerSpecialCaseList::inSectionBlame(SanitizerMask Mask, StringRef Prefix,
StringRef Category) const {
for (const auto &S : llvm::reverse(SanitizerSections)) {
if (S.Mask & Mask) {
- unsigned LineNum =
- SpecialCaseList::inSectionBlame(S.S.Entries, Prefix, Query, Category);
+ unsigned LineNum = S.S.getLastMatch(Prefix, Query, Category);
if (LineNum > 0)
return {S.S.FileIdx, LineNum};
}
diff --git a/llvm/include/llvm/Support/SpecialCaseList.h b/llvm/include/llvm/Support/SpecialCaseList.h
index c2c9271b0a37a..55d3d12dc3d5f 100644
--- a/llvm/include/llvm/Support/SpecialCaseList.h
+++ b/llvm/include/llvm/Support/SpecialCaseList.h
@@ -153,6 +153,11 @@ class SpecialCaseList {
SectionEntries Entries;
std::string SectionStr;
unsigned FileIdx;
+
+ // Helper method to search by Prefix, Query, and Category. Returns
+ // 1-based line number on which rule is defined, or 0 if there is no match.
+ LLVM_ABI unsigned getLastMatch(StringRef Prefix, StringRef Query,
+ StringRef Category) const;
};
std::vector<Section> Sections;
@@ -164,12 +169,6 @@ class SpecialCaseList {
/// Parses just-constructed SpecialCaseList entries from a memory buffer.
LLVM_ABI bool parse(unsigned FileIdx, const MemoryBuffer *MB,
std::string &Error);
-
- // Helper method for derived classes to search by Prefix, Query, and Category
- // once they have already resolved a section entry.
- LLVM_ABI unsigned inSectionBlame(const SectionEntries &Entries,
- StringRef Prefix, StringRef Query,
- StringRef Category) const;
};
} // namespace llvm
diff --git a/llvm/lib/Support/SpecialCaseList.cpp b/llvm/lib/Support/SpecialCaseList.cpp
index 4b038850b62ca..a9b502ad64f1d 100644
--- a/llvm/lib/Support/SpecialCaseList.cpp
+++ b/llvm/lib/Support/SpecialCaseList.cpp
@@ -219,7 +219,7 @@ SpecialCaseList::inSectionBlame(StringRef Section, StringRef Prefix,
StringRef Query, StringRef Category) const {
for (const auto &S : reverse(Sections)) {
if (S.SectionMatcher.match(Section)) {
- unsigned Blame = inSectionBlame(S.Entries, Prefix, Query, Category);
+ unsigned Blame = S.getLastMatch(Prefix, Query, Category);
if (Blame)
return {S.FileIdx, Blame};
}
@@ -227,9 +227,9 @@ SpecialCaseList::inSectionBlame(StringRef Section, StringRef Prefix,
return NotFound;
}
-unsigned SpecialCaseList::inSectionBlame(const SectionEntries &Entries,
- StringRef Prefix, StringRef Query,
- StringRef Category) const {
+unsigned SpecialCaseList::Section::getLastMatch(StringRef Prefix,
+ StringRef Query,
+ StringRef Category) const {
SectionEntries::const_iterator I = Entries.find(Prefix);
if (I == Entries.end())
return 0;
|
thurstond
approved these changes
Oct 7, 2025
qinkunbao
approved these changes
Oct 7, 2025
Created using spr 1.3.6 [skip ci]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
clang
Clang issues not falling into any other category
llvm:support
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.