Skip to content

Conversation

vitalybuka
Copy link
Collaborator

No description provided.

Created using spr 1.3.6
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Oct 7, 2025
@vitalybuka vitalybuka requested a review from qinkunbao October 7, 2025 22:07
@vitalybuka vitalybuka enabled auto-merge (squash) October 7, 2025 22:07
@llvmbot
Copy link
Member

llvmbot commented Oct 7, 2025

@llvm/pr-subscribers-clang

Author: Vitaly Buka (vitalybuka)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/162382.diff

2 Files Affected:

  • (modified) clang/include/clang/Basic/SanitizerSpecialCaseList.h (+2-4)
  • (modified) clang/lib/Basic/SanitizerSpecialCaseList.cpp (+4-4)
diff --git a/clang/include/clang/Basic/SanitizerSpecialCaseList.h b/clang/include/clang/Basic/SanitizerSpecialCaseList.h
index cf7485909e409..a05da4c1561d9 100644
--- a/clang/include/clang/Basic/SanitizerSpecialCaseList.h
+++ b/clang/include/clang/Basic/SanitizerSpecialCaseList.h
@@ -57,12 +57,10 @@ class SanitizerSpecialCaseList : public llvm::SpecialCaseList {
   void createSanitizerSections();
 
   struct SanitizerSection {
-    SanitizerSection(SanitizerMask SM, SectionEntries &E, unsigned idx)
-        : Mask(SM), Entries(E), FileIdx(idx) {};
+    SanitizerSection(SanitizerMask SM, const Section &S) : Mask(SM), S(S) {};
 
     SanitizerMask Mask;
-    SectionEntries &Entries;
-    unsigned FileIdx;
+    const Section &S;
   };
 
   std::vector<SanitizerSection> SanitizerSections;
diff --git a/clang/lib/Basic/SanitizerSpecialCaseList.cpp b/clang/lib/Basic/SanitizerSpecialCaseList.cpp
index 582c2557d8aa7..d8ccc50a8561e 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 (auto &S : Sections) {
+  for (const auto &S : Sections) {
     SanitizerMask Mask;
 
 #define SANITIZER(NAME, ID)                                                    \
@@ -50,7 +50,7 @@ void SanitizerSpecialCaseList::createSanitizerSections() {
 #undef SANITIZER
 #undef SANITIZER_GROUP
 
-    SanitizerSections.emplace_back(Mask, S.Entries, S.FileIdx);
+    SanitizerSections.emplace_back(Mask, S);
   }
 }
 
@@ -67,9 +67,9 @@ SanitizerSpecialCaseList::inSectionBlame(SanitizerMask Mask, StringRef Prefix,
   for (const auto &S : llvm::reverse(SanitizerSections)) {
     if (S.Mask & Mask) {
       unsigned LineNum =
-          SpecialCaseList::inSectionBlame(S.Entries, Prefix, Query, Category);
+          SpecialCaseList::inSectionBlame(S.S.Entries, Prefix, Query, Category);
       if (LineNum > 0)
-        return {S.FileIdx, LineNum};
+        return {S.S.FileIdx, LineNum};
     }
   }
   return NotFound;

@vitalybuka vitalybuka requested a review from thurstond October 7, 2025 22:30
if (S.Mask & Mask) {
unsigned LineNum =
SpecialCaseList::inSectionBlame(S.Entries, Prefix, Query, Category);
SpecialCaseList::inSectionBlame(S.S.Entries, Prefix, Query, Category);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S.S. is unfortunate naming

@vitalybuka vitalybuka merged commit 699f085 into main Oct 7, 2025
12 checks passed
@vitalybuka vitalybuka deleted the users/vitalybuka/spr/nfcsanitizersection-store-section-instead-of-entries-and-fileidx branch October 7, 2025 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants