================ @@ -477,6 +486,109 @@ void DiagnosticsEngine::setSeverityForAll(diag::Flavor Flavor, setSeverity(Diag, Map, Loc); } +namespace { +class WarningsSpecialCaseList : public llvm::SpecialCaseList { +public: + static std::unique_ptr<WarningsSpecialCaseList> + create(const llvm::MemoryBuffer &MB, std::string &Err) { + auto SCL = std::make_unique<WarningsSpecialCaseList>(); + if (!SCL->createInternal(&MB, Err)) + return nullptr; + return SCL; + } + + // Section names refer to diagnostic groups, which cover multiple individual + // diagnostics. Expand diagnostic groups here to individual diagnostics. + // A diagnostic can have multiple diagnostic groups associated with it, we let + // the last section take precedence in such cases. + void processSections(DiagnosticsEngine &Diags) { + // Drop the default section introduced by special case list, we only support + // exact diagnostic group names. + Sections.erase("*"); + // Make sure we iterate sections by their line numbers. + std::vector<std::pair<unsigned, const llvm::StringMapEntry<Section> *>> + LineAndSectionEntry; + LineAndSectionEntry.reserve(Sections.size()); + for (const auto &Entry : Sections) { + LineAndSectionEntry.emplace_back( + Entry.second.SectionMatcher->Globs.at(Entry.first()).second, &Entry); ---------------- bricknerb wrote:
There are 3 first and second references, consider putting some in variables to make it easier to follow what this actually does. https://github.com/llvm/llvm-project/pull/112517 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits