Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/lib/Basic/Diagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ WarningsSpecialCaseList::create(const llvm::MemoryBuffer &Input,

void WarningsSpecialCaseList::processSections(DiagnosticsEngine &Diags) {
static constexpr auto WarningFlavor = clang::diag::Flavor::WarningOrError;
for (const auto &SectionEntry : Sections) {
for (const auto &SectionEntry : sections()) {
StringRef DiagGroup = SectionEntry.SectionStr;
if (DiagGroup == "*") {
// Drop the default section introduced by special case list, we only
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Basic/ProfileList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ class ProfileSpecialCaseList : public llvm::SpecialCaseList {
createOrDie(const std::vector<std::string> &Paths,
llvm::vfs::FileSystem &VFS);

bool isEmpty() const { return Sections.empty(); }
bool isEmpty() const { return sections().empty(); }

bool hasPrefix(StringRef Prefix) const {
for (const auto &It : Sections)
for (const auto &It : sections())
if (It.Entries.count(Prefix) > 0)
return true;
return false;
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Basic/SanitizerSpecialCaseList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ SanitizerSpecialCaseList::createOrDie(const std::vector<std::string> &Paths,
}

void SanitizerSpecialCaseList::createSanitizerSections() {
for (const auto &S : Sections) {
for (const auto &S : sections()) {
SanitizerMask Mask;

#define SANITIZER(NAME, ID) \
Expand Down
6 changes: 6 additions & 0 deletions llvm/include/llvm/Support/SpecialCaseList.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#ifndef LLVM_SUPPORT_SPECIALCASELIST_H
#define LLVM_SUPPORT_SPECIALCASELIST_H

#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/GlobPattern.h"
Expand Down Expand Up @@ -118,6 +119,7 @@ class SpecialCaseList {
SpecialCaseList(SpecialCaseList const &) = delete;
SpecialCaseList &operator=(SpecialCaseList const &) = delete;

private:
/// Represents a set of globs and their line numbers
class Matcher {
public:
Expand Down Expand Up @@ -161,6 +163,7 @@ class SpecialCaseList {

using SectionEntries = StringMap<StringMap<Matcher>>;

protected:
struct Section {
Section(StringRef Str, unsigned FileIdx)
: SectionStr(Str), FileIdx(FileIdx) {};
Expand All @@ -187,6 +190,9 @@ class SpecialCaseList {
findMatcher(StringRef Prefix, StringRef Category) const;
};

ArrayRef<const Section> sections() const { return Sections; }

private:
std::vector<Section> Sections;

LLVM_ABI Expected<Section *> addSection(StringRef SectionStr,
Expand Down