Skip to content

Conversation

@vitalybuka
Copy link
Collaborator

This method is not used anywhere. Remove it.

@llvmbot
Copy link
Member

llvmbot commented Nov 9, 2025

@llvm/pr-subscribers-llvm-support

Author: Vitaly Buka (vitalybuka)

Changes

This method is not used anywhere. Remove it.


Full diff: https://github.com/llvm/llvm-project/pull/167193.diff

2 Files Affected:

  • (modified) llvm/include/llvm/Support/SpecialCaseList.h (-5)
  • (modified) llvm/lib/Support/SpecialCaseList.cpp (-13)
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

vitalybuka added a commit to vitalybuka/llvm-project that referenced this pull request Nov 10, 2025
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
vitalybuka added a commit to vitalybuka/llvm-project that referenced this pull request Nov 10, 2025
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
Created using spr 1.3.7

[skip ci]
Created using spr 1.3.7
vitalybuka added a commit to vitalybuka/llvm-project that referenced this pull request Nov 12, 2025
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
@vitalybuka vitalybuka changed the base branch from users/vitalybuka/spr/main.nfcsupport-remove-unused-getlongestmatch-from-specialcaselist to main November 14, 2025 22:02
@vitalybuka vitalybuka requested a review from Copilot November 14, 2025 22:02
Copilot finished reviewing on behalf of vitalybuka November 14, 2025 22:05
Copy link
Contributor

Copilot AI left a 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 getLongestMatch method and the Match type (pair of StringRef and unsigned) it relied on
  • Simplified all match() methods to return unsigned directly instead of a pair
  • Removed unused OrderBySize parameter from preprocess and createInternal methods

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.

@vitalybuka vitalybuka enabled auto-merge (squash) November 14, 2025 22:09
@vitalybuka vitalybuka merged commit 825ebef into main Nov 14, 2025
18 of 23 checks passed
@vitalybuka vitalybuka deleted the users/vitalybuka/spr/nfcsupport-remove-unused-getlongestmatch-from-specialcaselist branch November 14, 2025 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants