@@ -132,14 +132,17 @@ bool SpecialCaseList::createInternal(const MemoryBuffer *MB,
132132Expected<SpecialCaseList::Section *>
133133SpecialCaseList::addSection (StringRef SectionStr, unsigned LineNo,
134134 bool UseGlobs) {
135- auto [It, DidEmplace] = Sections.try_emplace (SectionStr);
136- auto &Section = It->getValue ();
137- if (DidEmplace)
138- if (auto Err = Section.SectionMatcher ->insert (SectionStr, LineNo, UseGlobs))
139- return createStringError (errc::invalid_argument,
140- " malformed section at line " + Twine (LineNo) +
141- " : '" + SectionStr +
142- " ': " + toString (std::move (Err)));
135+ Sections.emplace_back ();
136+ auto &Section = Sections.back ();
137+ Section.SectionStr = SectionStr;
138+
139+ if (auto Err = Section.SectionMatcher ->insert (SectionStr, LineNo, UseGlobs)) {
140+ return createStringError (errc::invalid_argument,
141+ " malformed section at line " + Twine (LineNo) +
142+ " : '" + SectionStr +
143+ " ': " + toString (std::move (Err)));
144+ }
145+
143146 return &Section;
144147}
145148
@@ -213,9 +216,8 @@ unsigned SpecialCaseList::inSectionBlame(StringRef Section, StringRef Prefix,
213216 StringRef Query,
214217 StringRef Category) const {
215218 for (const auto &It : Sections) {
216- const auto &S = It.getValue ();
217- if (S.SectionMatcher ->match (Section)) {
218- unsigned Blame = inSectionBlame (S.Entries , Prefix, Query, Category);
219+ if (It.SectionMatcher ->match (Section)) {
220+ unsigned Blame = inSectionBlame (It.Entries , Prefix, Query, Category);
219221 if (Blame)
220222 return Blame;
221223 }
@@ -227,9 +229,11 @@ unsigned SpecialCaseList::inSectionBlame(const SectionEntries &Entries,
227229 StringRef Prefix, StringRef Query,
228230 StringRef Category) const {
229231 SectionEntries::const_iterator I = Entries.find (Prefix);
230- if (I == Entries.end ()) return 0 ;
232+ if (I == Entries.end ())
233+ return 0 ;
231234 StringMap<Matcher>::const_iterator II = I->second .find (Category);
232- if (II == I->second .end ()) return 0 ;
235+ if (II == I->second .end ())
236+ return 0 ;
233237
234238 return II->getValue ().match (Query);
235239}
0 commit comments