@@ -811,25 +811,14 @@ pub mod parse {
811
811
}
812
812
813
813
pub ( crate ) fn parse_sanitizers ( slot : & mut SanitizerSet , v : Option < & str > ) -> bool {
814
- if let Some ( v) = v {
815
- for s in v. split ( ',' ) {
816
- * slot |= match s {
817
- "address" => SanitizerSet :: ADDRESS ,
818
- "cfi" => SanitizerSet :: CFI ,
819
- "dataflow" => SanitizerSet :: DATAFLOW ,
820
- "kcfi" => SanitizerSet :: KCFI ,
821
- "kernel-address" => SanitizerSet :: KERNELADDRESS ,
822
- "leak" => SanitizerSet :: LEAK ,
823
- "memory" => SanitizerSet :: MEMORY ,
824
- "memtag" => SanitizerSet :: MEMTAG ,
825
- "shadow-call-stack" => SanitizerSet :: SHADOWCALLSTACK ,
826
- "thread" => SanitizerSet :: THREAD ,
827
- "hwaddress" => SanitizerSet :: HWADDRESS ,
828
- "safestack" => SanitizerSet :: SAFESTACK ,
829
- _ => return false ,
830
- }
814
+ if let Some ( s) = v {
815
+ let sanitizer_set = SanitizerSet :: from_comma_list ( s) ;
816
+ if sanitizer_set. is_ok ( ) {
817
+ * slot |= sanitizer_set. unwrap ( ) ;
818
+ true
819
+ } else {
820
+ false
831
821
}
832
- true
833
822
} else {
834
823
false
835
824
}
@@ -1635,6 +1624,8 @@ options! {
1635
1624
"output remarks for these optimization passes (space separated, or \" all\" )" ) ,
1636
1625
rpath: bool = ( false , parse_bool, [ UNTRACKED ] ,
1637
1626
"set rpath values in libs/exes (default: no)" ) ,
1627
+ sanitize: SanitizerSet = ( SanitizerSet :: empty( ) , parse_sanitizers, [ TRACKED ] ,
1628
+ "use one or multiple sanitizers" ) ,
1638
1629
save_temps: bool = ( false , parse_bool, [ UNTRACKED ] ,
1639
1630
"save all temporary output files during compilation (default: no)" ) ,
1640
1631
soft_float: bool = ( false , parse_bool, [ TRACKED ] ,
@@ -2003,8 +1994,6 @@ options! {
2003
1994
remark_dir: Option <PathBuf > = ( None , parse_opt_pathbuf, [ UNTRACKED ] ,
2004
1995
"directory into which to write optimization remarks (if not specified, they will be \
2005
1996
written to standard error output)") ,
2006
- sanitizer: SanitizerSet = ( SanitizerSet :: empty( ) , parse_sanitizers, [ TRACKED ] ,
2007
- "use a sanitizer" ) ,
2008
1997
sanitizer_cfi_canonical_jump_tables: Option <bool > = ( Some ( true ) , parse_opt_bool, [ TRACKED ] ,
2009
1998
"enable canonical jump tables (default: yes)" ) ,
2010
1999
sanitizer_cfi_generalize_pointers: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
0 commit comments