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

Qinkun Bao via cfe-commits cfe-commits at lists.llvm.org
Mon May 19 12:51:25 PDT 2025


================
@@ -44,6 +44,13 @@ bool NoSanitizeList::containsFunction(SanitizerMask Mask,
 
 bool NoSanitizeList::containsFile(SanitizerMask Mask, StringRef FileName,
                                   StringRef Category) const {
+  unsigned NoSanLine = SSCL->inSectionBlame(Mask, "src", FileName, Category);
+  unsigned SanLine = SSCL->inSectionBlame(Mask, "src", FileName, "sanitize");
+  // If we have two cases such as `src:a.cpp=sanitize` and `src:a.cpp`, the
+  // current entry override the previous entry.
+  if (NoSanLine > 0 && SanLine > 0) {
----------------
qinkunbao wrote:

Thank you for the link.

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


More information about the cfe-commits mailing list