Skip to content

Commit 857961d

Browse files
authored
[NFC][SpecialCaseList] Hide more details in private section (#162302)
1 parent 3a3b214 commit 857961d

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

clang/lib/Basic/Diagnostic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ WarningsSpecialCaseList::create(const llvm::MemoryBuffer &Input,
532532

533533
void WarningsSpecialCaseList::processSections(DiagnosticsEngine &Diags) {
534534
static constexpr auto WarningFlavor = clang::diag::Flavor::WarningOrError;
535-
for (const auto &SectionEntry : Sections) {
535+
for (const auto &SectionEntry : sections()) {
536536
StringRef DiagGroup = SectionEntry.SectionStr;
537537
if (DiagGroup == "*") {
538538
// Drop the default section introduced by special case list, we only

clang/lib/Basic/ProfileList.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ class ProfileSpecialCaseList : public llvm::SpecialCaseList {
3232
createOrDie(const std::vector<std::string> &Paths,
3333
llvm::vfs::FileSystem &VFS);
3434

35-
bool isEmpty() const { return Sections.empty(); }
35+
bool isEmpty() const { return sections().empty(); }
3636

3737
bool hasPrefix(StringRef Prefix) const {
38-
for (const auto &It : Sections)
38+
for (const auto &It : sections())
3939
if (It.Entries.count(Prefix) > 0)
4040
return true;
4141
return false;

clang/lib/Basic/SanitizerSpecialCaseList.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ SanitizerSpecialCaseList::createOrDie(const std::vector<std::string> &Paths,
3838
}
3939

4040
void SanitizerSpecialCaseList::createSanitizerSections() {
41-
for (const auto &S : Sections) {
41+
for (const auto &S : sections()) {
4242
SanitizerMask Mask;
4343

4444
#define SANITIZER(NAME, ID) \

llvm/include/llvm/Support/SpecialCaseList.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#ifndef LLVM_SUPPORT_SPECIALCASELIST_H
1313
#define LLVM_SUPPORT_SPECIALCASELIST_H
1414

15+
#include "llvm/ADT/ArrayRef.h"
1516
#include "llvm/ADT/StringMap.h"
1617
#include "llvm/Support/Compiler.h"
1718
#include "llvm/Support/GlobPattern.h"
@@ -118,6 +119,7 @@ class SpecialCaseList {
118119
SpecialCaseList(SpecialCaseList const &) = delete;
119120
SpecialCaseList &operator=(SpecialCaseList const &) = delete;
120121

122+
private:
121123
/// Represents a set of globs and their line numbers
122124
class Matcher {
123125
public:
@@ -161,6 +163,7 @@ class SpecialCaseList {
161163

162164
using SectionEntries = StringMap<StringMap<Matcher>>;
163165

166+
protected:
164167
struct Section {
165168
Section(StringRef Str, unsigned FileIdx)
166169
: SectionStr(Str), FileIdx(FileIdx) {};
@@ -187,6 +190,9 @@ class SpecialCaseList {
187190
findMatcher(StringRef Prefix, StringRef Category) const;
188191
};
189192

193+
ArrayRef<const Section> sections() const { return Sections; }
194+
195+
private:
190196
std::vector<Section> Sections;
191197

192198
LLVM_ABI Expected<Section *> addSection(StringRef SectionStr,

0 commit comments

Comments
 (0)