[clang] [UBSan] Move type:*=sanitize handling. (PR #142006)

Justin Stitt via cfe-commits cfe-commits at lists.llvm.org
Thu May 29 13:57:28 PDT 2025


================
@@ -34,7 +34,11 @@ bool NoSanitizeList::containsGlobal(SanitizerMask Mask, StringRef GlobalName,
 
 bool NoSanitizeList::containsType(SanitizerMask Mask, StringRef MangledTypeName,
                                   StringRef Category) const {
-  return SSCL->inSection(Mask, "type", MangledTypeName, Category);
+  auto NoSan = SSCL->inSectionBlame(Mask, "type", MangledTypeName, Category);
+  if (NoSan == llvm::SpecialCaseList::NotFound)
+    return false;
+  auto San = SSCL->inSectionBlame(Mask, "type", MangledTypeName, "sanitize");
+  return San == llvm::SpecialCaseList::NotFound || NoSan > San;
----------------
JustinStitt wrote:

PR looks good to me. Only quirk is `NoSan > San`. The `auto`s slightly obscure the fact these are `pair` types. Thankfully, the `FileIdx` portion of the pair is properly mapped left-to-right alongside all the `-fsanitize-ignorelist=` arguments within `SpecialCaseList::createInternal`. This means we'll get the obvious behavior of most recent SCL file which is then further delineated by line number.

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


More information about the cfe-commits mailing list