[llvm-branch-commits] [llvm] [NFCI] Avoid adding duplicated SpecialCaseList::Sections. (PR #140821)
Qinkun Bao via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue May 20 17:28:54 PDT 2025
https://github.com/qinkunbao updated https://github.com/llvm/llvm-project/pull/140821
>From bb0e2f0bb26a47602978d1ac6f3d73a770075900 Mon Sep 17 00:00:00 2001
From: Qinkun Bao <qinkun at google.com>
Date: Wed, 21 May 2025 00:28:47 +0000
Subject: [PATCH] Remove lineno.
Created using spr 1.3.6
---
llvm/include/llvm/Support/SpecialCaseList.h | 1 -
llvm/lib/Support/SpecialCaseList.cpp | 3 +--
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/llvm/include/llvm/Support/SpecialCaseList.h b/llvm/include/llvm/Support/SpecialCaseList.h
index baa5c917220e3..fc6dc93651f38 100644
--- a/llvm/include/llvm/Support/SpecialCaseList.h
+++ b/llvm/include/llvm/Support/SpecialCaseList.h
@@ -138,7 +138,6 @@ class SpecialCaseList {
std::unique_ptr<Matcher> SectionMatcher;
SectionEntries Entries;
std::string SectionStr;
- unsigned LineNo;
};
std::vector<Section> Sections;
diff --git a/llvm/lib/Support/SpecialCaseList.cpp b/llvm/lib/Support/SpecialCaseList.cpp
index e8dac4680f96f..2d84f7f22cd7b 100644
--- a/llvm/lib/Support/SpecialCaseList.cpp
+++ b/llvm/lib/Support/SpecialCaseList.cpp
@@ -139,13 +139,12 @@ SpecialCaseList::addSection(StringRef SectionStr, unsigned LineNo,
bool UseGlobs) {
auto it =
std::find_if(Sections.begin(), Sections.end(), [&](const Section &s) {
- return s.SectionStr == SectionStr && s.LineNo == LineNo;
+ return s.SectionStr == SectionStr;
});
if (it == Sections.end()) {
Sections.emplace_back();
auto &sec = Sections.back();
sec.SectionStr = SectionStr;
- sec.LineNo = LineNo;
it = std::prev(Sections.end());
}
if (auto Err = it->SectionMatcher->insert(SectionStr, LineNo, UseGlobs)) {
More information about the llvm-branch-commits
mailing list