[llvm] 857961d - [NFC][SpecialCaseList] Hide more details in private section (#162302)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 8 13:22:26 PDT 2025


Author: Vitaly Buka
Date: 2025-10-08T20:22:22Z
New Revision: 857961d12ae953e1fe7d3ec452e6b0c5a43987fd

URL: https://github.com/llvm/llvm-project/commit/857961d12ae953e1fe7d3ec452e6b0c5a43987fd
DIFF: https://github.com/llvm/llvm-project/commit/857961d12ae953e1fe7d3ec452e6b0c5a43987fd.diff

LOG: [NFC][SpecialCaseList] Hide more details in private section (#162302)

Added: 
    

Modified: 
    clang/lib/Basic/Diagnostic.cpp
    clang/lib/Basic/ProfileList.cpp
    clang/lib/Basic/SanitizerSpecialCaseList.cpp
    llvm/include/llvm/Support/SpecialCaseList.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp
index a955c3bca337f..8ecbd3c5a2cc4 100644
--- a/clang/lib/Basic/Diagnostic.cpp
+++ b/clang/lib/Basic/Diagnostic.cpp
@@ -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

diff  --git a/clang/lib/Basic/ProfileList.cpp b/clang/lib/Basic/ProfileList.cpp
index 8481deffe2a7b..9cb118893a0d9 100644
--- a/clang/lib/Basic/ProfileList.cpp
+++ b/clang/lib/Basic/ProfileList.cpp
@@ -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;

diff  --git a/clang/lib/Basic/SanitizerSpecialCaseList.cpp b/clang/lib/Basic/SanitizerSpecialCaseList.cpp
index 792000b545fb8..56f551628cf89 100644
--- a/clang/lib/Basic/SanitizerSpecialCaseList.cpp
+++ b/clang/lib/Basic/SanitizerSpecialCaseList.cpp
@@ -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)                                                    \

diff  --git a/llvm/include/llvm/Support/SpecialCaseList.h b/llvm/include/llvm/Support/SpecialCaseList.h
index d8dd1c4ec4bbc..c7a10e34618d7 100644
--- a/llvm/include/llvm/Support/SpecialCaseList.h
+++ b/llvm/include/llvm/Support/SpecialCaseList.h
@@ -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"
@@ -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:
@@ -161,6 +163,7 @@ class SpecialCaseList {
 
   using SectionEntries = StringMap<StringMap<Matcher>>;
 
+protected:
   struct Section {
     Section(StringRef Str, unsigned FileIdx)
         : SectionStr(Str), FileIdx(FileIdx) {};
@@ -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,


        


More information about the llvm-commits mailing list