-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[NFC][Support] Remove unused getLongestMatch from SpecialCaseList #167193
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
[NFC][Support] Remove unused getLongestMatch from SpecialCaseList #167193
Conversation
Created using spr 1.3.7 [skip ci]
Created using spr 1.3.7
|
@llvm/pr-subscribers-llvm-support Author: Vitaly Buka (vitalybuka) ChangesThis method is not used anywhere. Remove it. Full diff: https://github.com/llvm/llvm-project/pull/167193.diff 2 Files Affected:
diff --git a/llvm/include/llvm/Support/SpecialCaseList.h b/llvm/include/llvm/Support/SpecialCaseList.h
index cb8e568de02e0..a10bbc61dcc3e 100644
--- a/llvm/include/llvm/Support/SpecialCaseList.h
+++ b/llvm/include/llvm/Support/SpecialCaseList.h
@@ -218,11 +218,6 @@ class SpecialCaseList {
LLVM_ABI unsigned getLastMatch(StringRef Prefix, StringRef Query,
StringRef Category) const;
- // Helper method to search by Prefix, Query, and Category. Returns
- // matching rule, or empty string if there is no match.
- LLVM_ABI StringRef getLongestMatch(StringRef Prefix, StringRef Query,
- StringRef Category) const;
-
private:
friend class SpecialCaseList;
LLVM_ABI void preprocess(bool OrderBySize);
diff --git a/llvm/lib/Support/SpecialCaseList.cpp b/llvm/lib/Support/SpecialCaseList.cpp
index 246d90cce3a43..813fce35d88fe 100644
--- a/llvm/lib/Support/SpecialCaseList.cpp
+++ b/llvm/lib/Support/SpecialCaseList.cpp
@@ -380,17 +380,4 @@ unsigned SpecialCaseList::Section::getLastMatch(StringRef Prefix,
return LastLine;
}
-StringRef SpecialCaseList::Section::getLongestMatch(StringRef Prefix,
- StringRef Query,
- StringRef Category) const {
- StringRef LongestRule;
- if (const Matcher *M = findMatcher(Prefix, Category)) {
- M->match(Query, [&](StringRef Rule, unsigned) {
- if (LongestRule.size() < Rule.size())
- LongestRule = Rule;
- });
- }
- return LongestRule;
-}
-
} // namespace llvm
|
This method is not used anywhere. Remove it. Pull Request: llvm#167193
Created using spr 1.3.7 [skip ci]
This method is not used anywhere. Remove it. Pull Request: llvm#167193
Created using spr 1.3.7 [skip ci]
Created using spr 1.3.7 [skip ci]
This method is not used anywhere. Remove it. Pull Request: llvm#167193
Created using spr 1.3.7 [skip ci]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes the unused getLongestMatch method from SpecialCaseList and simplifies related code by eliminating unnecessary infrastructure that supported this unused functionality.
Key changes:
- Removed
getLongestMatchmethod and theMatchtype (pair of StringRef and unsigned) it relied on - Simplified all
match()methods to returnunsigneddirectly instead of a pair - Removed unused
OrderBySizeparameter frompreprocessandcreateInternalmethods
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| llvm/include/llvm/Support/SpecialCaseList.h | Removed getLongestMatch method declaration and simplified method signatures by removing unused OrderBySize parameter |
| llvm/lib/Support/SpecialCaseList.cpp | Removed getLongestMatch implementation, eliminated Match type and NotMatched constant, simplified all match methods to return line numbers directly, and removed unused size-based sorting logic |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This method is not used anywhere. Remove it.