[clang] [llvm] [UBSan] Support src:*=sanitize for multiple ignorelists. (PR #141640)

Shafik Yaghmour via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 3 14:41:06 PDT 2025


================
@@ -44,20 +45,24 @@ class SanitizerSpecialCaseList : public llvm::SpecialCaseList {
                  StringRef Category = StringRef()) const;
 
   // Query ignorelisted entries if any bit in Mask matches the entry's section.
-  // Return 0 if not found. If found, return the line number (starts with 1).
-  unsigned inSectionBlame(SanitizerMask Mask, StringRef Prefix, StringRef Query,
-                          StringRef Category = StringRef()) const;
+  // Return NotFound (0,0) if not found. If found, return the file index number
+  // and the line number (FileIdx, LineNo) (FileIdx starts with 1 and LineNo
+  // starts with 0).
+  std::pair<unsigned, unsigned>
----------------
shafik wrote:

I won't insist, but if we won't actually (maybe I am misunderstanding) use the value stored in the pair then a flag makes way more sense. Otherwise, having to use `first` and `second` is just prone to error. 

I do get that this is local and that we (llvm) is not free of anti-patterns but we should strive to do better in new code. One because future new users might use this to learn and outside developers (even LLMs) will learn this is a good pattern and propagate its use.

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


More information about the llvm-commits mailing list