[clang] [llvm] [UBSan] Implement src:*=sanitize for UBSan (PR #140529)

Vitaly Buka via cfe-commits cfe-commits at lists.llvm.org
Mon May 26 11:52:58 PDT 2025


================
@@ -56,10 +56,20 @@ void SanitizerSpecialCaseList::createSanitizerSections() {
 bool SanitizerSpecialCaseList::inSection(SanitizerMask Mask, StringRef Prefix,
                                          StringRef Query,
                                          StringRef Category) const {
-  for (auto &S : SanitizerSections)
-    if ((S.Mask & Mask) &&
-        SpecialCaseList::inSectionBlame(S.Entries, Prefix, Query, Category))
-      return true;
+  return inSectionBlame(Mask, Prefix, Query, Category);
+}
 
-  return false;
+unsigned SanitizerSpecialCaseList::inSectionBlame(SanitizerMask Mask,
+                                                  StringRef Prefix,
+                                                  StringRef Query,
+                                                  StringRef Category) const {
+  for (auto &S : SanitizerSections) {
----------------
vitalybuka wrote:

same src can be matched by multiple sections, and we want the last one

I believe we need to iterate SanitizerSections reverse as well?
Can you please figure out a test case which fails here?

https://github.com/llvm/llvm-project/pull/140529


More information about the cfe-commits mailing list