@@ -239,18 +239,6 @@ class CompileCheckMode(enum.Enum):
239239}
240240
241241
242- # TODO: Can we delete this?
243- def option_enabled (boptions : T .Set [OptionKey ],
244- target : 'BuildTarget' ,
245- env : 'Environment' ,
246- option : T .Union [str , OptionKey ]) -> bool :
247- if isinstance (option , str ):
248- option = OptionKey (option )
249- if option not in boptions :
250- return False
251- return env .coredata .optstore .get_option_for_target (target , option , bool , default = False )
252-
253-
254242def are_asserts_disabled (target : 'BuildTarget' , env : 'Environment' ) -> bool :
255243 """Should debug assertions be disabled
256244
@@ -322,7 +310,7 @@ def get_base_compile_args(target: 'BuildTarget', compiler: 'Compiler', env: 'Env
322310 except KeyError :
323311 pass
324312 # This does not need a try...except
325- bitcode = option_enabled ( compiler . base_options , target , env , 'b_bitcode' )
313+ bitcode = env . coredata . optstore . get_option_for_target ( target , OptionKey ( 'b_bitcode' ), bool , default = False )
326314 args .extend (compiler .get_embed_bitcode_args (bitcode , lto ))
327315 try :
328316 crt_val = env .coredata .optstore .get_option_for_target (target , OptionKey ('b_vscrt' ), str )
@@ -389,8 +377,8 @@ def get_base_link_args(target: 'BuildTarget',
389377 except (KeyError , AttributeError ):
390378 pass
391379
392- as_needed = option_enabled ( linker . base_options , target , env , 'b_asneeded' )
393- bitcode = option_enabled ( linker . base_options , target , env , 'b_bitcode' )
380+ as_needed = env . coredata . optstore . get_option_for_target ( target , OptionKey ( 'b_asneeded' ), bool , default = False )
381+ bitcode = env . coredata . optstore . get_option_for_target ( target , OptionKey ( 'b_bitcode' ), bool , default = False )
394382 # Shared modules cannot be built with bitcode_bundle because
395383 # -bitcode_bundle is incompatible with -undefined and -bundle
396384 if bitcode and not target .typename == 'shared module' :
@@ -405,7 +393,7 @@ def get_base_link_args(target: 'BuildTarget',
405393 from ..build import SharedModule
406394 args .extend (linker .headerpad_args ())
407395 if (not isinstance (target , SharedModule ) and
408- option_enabled ( linker . base_options , target , env , 'b_lundef' )):
396+ env . coredata . optstore . get_option_for_target ( target , OptionKey ( 'b_lundef' ), bool , default = False )):
409397 args .extend (linker .no_undefined_link_args ())
410398 else :
411399 args .extend (linker .get_allow_undefined_link_args ())
0 commit comments