[llvm-branch-commits] Fix the unit test errors. (PR #140184)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu May 15 21:03:01 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-support

Author: Qinkun Bao (qinkunbao)

<details>
<summary>Changes</summary>



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


2 Files Affected:

- (modified) llvm/include/llvm/Support/SpecialCaseList.h (+2-3) 
- (modified) llvm/lib/Support/SpecialCaseList.cpp (+2-1) 


``````````diff
diff --git a/llvm/include/llvm/Support/SpecialCaseList.h b/llvm/include/llvm/Support/SpecialCaseList.h
index 4f4c097c7162a..fc6dc93651f38 100644
--- a/llvm/include/llvm/Support/SpecialCaseList.h
+++ b/llvm/include/llvm/Support/SpecialCaseList.h
@@ -132,9 +132,8 @@ class SpecialCaseList {
   using SectionEntries = StringMap<StringMap<Matcher>>;
 
   struct Section {
-    Section(std::unique_ptr<Matcher> M, StringRef str)
-        : SectionMatcher(std::move(M)), SectionStr(SectionStr) {};
-    Section(StringRef str) : Section(std::make_unique<Matcher>(), str) {};
+    Section(std::unique_ptr<Matcher> M) : SectionMatcher(std::move(M)) {};
+    Section() : Section(std::make_unique<Matcher>()) {};
 
     std::unique_ptr<Matcher> SectionMatcher;
     SectionEntries Entries;
diff --git a/llvm/lib/Support/SpecialCaseList.cpp b/llvm/lib/Support/SpecialCaseList.cpp
index 76c705c097aaa..9f044ced3a17c 100644
--- a/llvm/lib/Support/SpecialCaseList.cpp
+++ b/llvm/lib/Support/SpecialCaseList.cpp
@@ -132,8 +132,9 @@ bool SpecialCaseList::createInternal(const MemoryBuffer *MB,
 Expected<SpecialCaseList::Section *>
 SpecialCaseList::addSection(StringRef SectionStr, unsigned LineNo,
                             bool UseGlobs) {
-  Sections.emplace_back(SectionStr);
+  Sections.emplace_back();
   auto &Section = Sections.back();
+  Section.SectionStr = SectionStr;
 
   if (auto Err = Section.SectionMatcher->insert(SectionStr, LineNo, UseGlobs)) {
     return createStringError(errc::invalid_argument,

``````````

</details>


https://github.com/llvm/llvm-project/pull/140184


More information about the llvm-branch-commits mailing list