[clang] [llvm] [UBSan] Implement src:*=sanitize for UBSan (PR #140529)
    Qinkun Bao via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed May 21 11:19:41 PDT 2025
    
    
  
================
@@ -63,6 +63,11 @@ Error SpecialCaseList::Matcher::insert(StringRef Pattern, unsigned LineNumber,
                        .moveInto(Pair.first))
       return Err;
     Pair.second = LineNumber;
+  } else {
----------------
qinkunbao wrote:
I believe the change inside `SpecialCaseList::Matcher::insert` is needed. 
Consider the following example,
```
1 src:*
2 src:*/test1.c
3 src:*/test1.c=sanitize
4 src:*/test1.c
```
`src:*/test1.c` at line 2 and `src:*/test1.c` at line 4 shares the same Section, Prefix and Query and Catogory. As a result, when the previous implementation will skip updating the lineNo. Without the change, we can not know the correct line number even if we do a reverse order iteration. (I tested it by removing the change inside `SpecialCaseList::Matcher::insert` and walking Globs/Regex in reverse order. The test will fail for src.ignorelist.contradict4
> Also we need a patch to Matcher::Globs -> vector
Will change it in a new PR. 
https://github.com/llvm/llvm-project/pull/140529
    
    
More information about the llvm-commits
mailing list