@@ -132,14 +132,16 @@ 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 (SectionStr);
136+ auto &Section = Sections.back ();
137+
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)));
143+ }
144+
143145 return &Section;
144146}
145147
@@ -213,9 +215,8 @@ unsigned SpecialCaseList::inSectionBlame(StringRef Section, StringRef Prefix,
213215 StringRef Query,
214216 StringRef Category) const {
215217 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);
218+ if (It.SectionMatcher ->match (Section)) {
219+ unsigned Blame = inSectionBlame (It.Entries , Prefix, Query, Category);
219220 if (Blame)
220221 return Blame;
221222 }
@@ -227,9 +228,11 @@ unsigned SpecialCaseList::inSectionBlame(const SectionEntries &Entries,
227228 StringRef Prefix, StringRef Query,
228229 StringRef Category) const {
229230 SectionEntries::const_iterator I = Entries.find (Prefix);
230- if (I == Entries.end ()) return 0 ;
231+ if (I == Entries.end ())
232+ return 0 ;
231233 StringMap<Matcher>::const_iterator II = I->second .find (Category);
232- if (II == I->second .end ()) return 0 ;
234+ if (II == I->second .end ())
235+ return 0 ;
233236
234237 return II->getValue ().match (Query);
235238}
0 commit comments