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>; struct Section { - Section(std::unique_ptr M, StringRef str) - : SectionMatcher(std::move(M)), SectionStr(SectionStr) {}; - Section(StringRef str) : Section(std::make_unique(), str) {}; + Section(std::unique_ptr M) : SectionMatcher(std::move(M)) {}; + Section() : Section(std::make_unique()) {}; std::unique_ptr 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::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,