@@ -533,24 +533,25 @@ void WarningsSpecialCaseList::processSections(DiagnosticsEngine &Diags) {
533533 // Drop the default section introduced by special case list, we only support
534534 // exact diagnostic group names.
535535 // FIXME: We should make this configurable in the parser instead.
536- Sections.erase (" *" );
536+ // FIXME: C++20 can use std::erase_if(Sections, [](Section &sec) { return
537+ // sec.SectionStr == "*"; });
538+ llvm::erase_if (Sections, [](Section &sec) { return sec.SectionStr == " *" ; });
537539 // Make sure we iterate sections by their line numbers.
538- std::vector<std::pair<unsigned , const llvm::StringMapEntry<Section> *>>
539- LineAndSectionEntry;
540+ std::vector<std::pair<unsigned , const Section *>> LineAndSectionEntry;
540541 LineAndSectionEntry.reserve (Sections.size ());
541542 for (const auto &Entry : Sections) {
542- StringRef DiagName = Entry.getKey () ;
543+ StringRef DiagName = Entry.SectionStr ;
543544 // Each section has a matcher with that section's name, attached to that
544545 // line.
545- const auto &DiagSectionMatcher = Entry.getValue (). SectionMatcher ;
546+ const auto &DiagSectionMatcher = Entry.SectionMatcher ;
546547 unsigned DiagLine = DiagSectionMatcher->Globs .at (DiagName).second ;
547548 LineAndSectionEntry.emplace_back (DiagLine, &Entry);
548549 }
549550 llvm::sort (LineAndSectionEntry);
550551 static constexpr auto WarningFlavor = clang::diag::Flavor::WarningOrError;
551552 for (const auto &[_, SectionEntry] : LineAndSectionEntry) {
552553 SmallVector<diag::kind> GroupDiags;
553- StringRef DiagGroup = SectionEntry->getKey () ;
554+ StringRef DiagGroup = SectionEntry->SectionStr ;
554555 if (Diags.getDiagnosticIDs ()->getDiagnosticsInGroup (
555556 WarningFlavor, DiagGroup, GroupDiags)) {
556557 StringRef Suggestion =
@@ -563,7 +564,7 @@ void WarningsSpecialCaseList::processSections(DiagnosticsEngine &Diags) {
563564 for (diag::kind Diag : GroupDiags)
564565 // We're intentionally overwriting any previous mappings here to make sure
565566 // latest one takes precedence.
566- DiagToSection[Diag] = & SectionEntry-> getValue () ;
567+ DiagToSection[Diag] = SectionEntry;
567568 }
568569}
569570
0 commit comments