@@ -27,18 +27,29 @@ NoSanitizeList::NoSanitizeList(const std::vector<std::string> &NoSanitizePaths,
27
27
28
28
NoSanitizeList::~NoSanitizeList () = default ;
29
29
30
+ bool NoSanitizeList::containsPrefix (SanitizerMask Mask, StringRef Prefix,
31
+ StringRef Name, StringRef Category) const {
32
+ std::pair<unsigned , unsigned > NoSan =
33
+ SSCL->inSectionBlame (Mask, Prefix, Name, Category);
34
+ if (NoSan == llvm::SpecialCaseList::NotFound)
35
+ return false ;
36
+ std::pair<unsigned , unsigned > San =
37
+ SSCL->inSectionBlame (Mask, Prefix, Name, " sanitize" );
38
+ // The statement evaluates to true under the following conditions:
39
+ // 1. The string "prefix:*=sanitize" is absent.
40
+ // 2. If "prefix:*=sanitize" is present, its (File Index, Line Number) is less
41
+ // than that of "prefix:*".
42
+ return San == llvm::SpecialCaseList::NotFound || NoSan > San;
43
+ }
44
+
30
45
bool NoSanitizeList::containsGlobal (SanitizerMask Mask, StringRef GlobalName,
31
46
StringRef Category) const {
32
47
return SSCL->inSection (Mask, " global" , GlobalName, Category);
33
48
}
34
49
35
50
bool NoSanitizeList::containsType (SanitizerMask Mask, StringRef MangledTypeName,
36
51
StringRef Category) const {
37
- auto NoSan = SSCL->inSectionBlame (Mask, " type" , MangledTypeName, Category);
38
- if (NoSan == llvm::SpecialCaseList::NotFound)
39
- return false ;
40
- auto San = SSCL->inSectionBlame (Mask, " type" , MangledTypeName, " sanitize" );
41
- return San == llvm::SpecialCaseList::NotFound || NoSan > San;
52
+ return containsPrefix (Mask, " type" , MangledTypeName, Category);
42
53
}
43
54
44
55
bool NoSanitizeList::containsFunction (SanitizerMask Mask,
@@ -48,11 +59,7 @@ bool NoSanitizeList::containsFunction(SanitizerMask Mask,
48
59
49
60
bool NoSanitizeList::containsFile (SanitizerMask Mask, StringRef FileName,
50
61
StringRef Category) const {
51
- auto NoSan = SSCL->inSectionBlame (Mask, " src" , FileName, Category);
52
- if (NoSan == llvm::SpecialCaseList::NotFound)
53
- return false ;
54
- auto San = SSCL->inSectionBlame (Mask, " src" , FileName, " sanitize" );
55
- return San == llvm::SpecialCaseList::NotFound || NoSan > San;
62
+ return containsPrefix (Mask, " src" , FileName, Category);
56
63
}
57
64
58
65
bool NoSanitizeList::containsMainFile (SanitizerMask Mask, StringRef FileName,
0 commit comments