@@ -1156,25 +1156,14 @@ pub mod parse {
1156
1156
}
1157
1157
1158
1158
pub ( crate ) fn parse_sanitizers ( slot : & mut SanitizerSet , v : Option < & str > ) -> bool {
1159
- if let Some ( v) = v {
1160
- for s in v. split ( ',' ) {
1161
- * slot |= match s {
1162
- "address" => SanitizerSet :: ADDRESS ,
1163
- "cfi" => SanitizerSet :: CFI ,
1164
- "dataflow" => SanitizerSet :: DATAFLOW ,
1165
- "kcfi" => SanitizerSet :: KCFI ,
1166
- "kernel-address" => SanitizerSet :: KERNELADDRESS ,
1167
- "leak" => SanitizerSet :: LEAK ,
1168
- "memory" => SanitizerSet :: MEMORY ,
1169
- "memtag" => SanitizerSet :: MEMTAG ,
1170
- "shadow-call-stack" => SanitizerSet :: SHADOWCALLSTACK ,
1171
- "thread" => SanitizerSet :: THREAD ,
1172
- "hwaddress" => SanitizerSet :: HWADDRESS ,
1173
- "safestack" => SanitizerSet :: SAFESTACK ,
1174
- _ => return false ,
1175
- }
1159
+ if let Some ( s) = v {
1160
+ let sanitizer_set = SanitizerSet :: from_comma_list ( s) ;
1161
+ if sanitizer_set. is_ok ( ) {
1162
+ * slot |= sanitizer_set. unwrap ( ) ;
1163
+ true
1164
+ } else {
1165
+ false
1176
1166
}
1177
- true
1178
1167
} else {
1179
1168
false
1180
1169
}
@@ -2043,6 +2032,8 @@ options! {
2043
2032
"output remarks for these optimization passes (space separated, or \" all\" )" ) ,
2044
2033
rpath: bool = ( false , parse_bool, [ UNTRACKED ] ,
2045
2034
"set rpath values in libs/exes (default: no)" ) ,
2035
+ sanitize: SanitizerSet = ( SanitizerSet :: empty( ) , parse_sanitizers, [ TRACKED ] ,
2036
+ "use one or multiple sanitizers" ) ,
2046
2037
save_temps: bool = ( false , parse_bool, [ UNTRACKED ] ,
2047
2038
"save all temporary output files during compilation (default: no)" ) ,
2048
2039
soft_float: bool = ( false , parse_bool, [ TRACKED ] ,
@@ -2440,8 +2431,6 @@ options! {
2440
2431
remark_dir: Option <PathBuf > = ( None , parse_opt_pathbuf, [ UNTRACKED ] ,
2441
2432
"directory into which to write optimization remarks (if not specified, they will be \
2442
2433
written to standard error output)") ,
2443
- sanitizer: SanitizerSet = ( SanitizerSet :: empty( ) , parse_sanitizers, [ TRACKED ] ,
2444
- "use a sanitizer" ) ,
2445
2434
sanitizer_cfi_canonical_jump_tables: Option <bool > = ( Some ( true ) , parse_opt_bool, [ TRACKED ] ,
2446
2435
"enable canonical jump tables (default: yes)" ) ,
2447
2436
sanitizer_cfi_generalize_pointers: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
0 commit comments