@@ -240,18 +240,6 @@ class CompileCheckMode(enum.Enum):
240240}
241241
242242
243- # TODO: Can we delete this?
244- def option_enabled (boptions : T .Set [OptionKey ],
245- target : 'BuildTarget' ,
246- env : 'Environment' ,
247- option : T .Union [str , OptionKey ]) -> bool :
248- if isinstance (option , str ):
249- option = OptionKey (option )
250- if option not in boptions :
251- return False
252- return env .coredata .optstore .get_option_for_target (target , option , bool , default = False )
253-
254-
255243def are_asserts_disabled (target : 'BuildTarget' , env : 'Environment' ) -> bool :
256244 """Should debug assertions be disabled
257245
@@ -323,7 +311,7 @@ def get_base_compile_args(target: 'BuildTarget', compiler: 'Compiler', env: 'Env
323311 except KeyError :
324312 pass
325313 # This does not need a try...except
326- bitcode = option_enabled ( compiler . base_options , target , env , 'b_bitcode' )
314+ bitcode = env . coredata . optstore . get_option_for_target ( target , OptionKey ( 'b_bitcode' ), bool , default = False )
327315 args .extend (compiler .get_embed_bitcode_args (bitcode , lto ))
328316 try :
329317 crt_val = env .coredata .optstore .get_option_for_target (target , OptionKey ('b_vscrt' ), str )
@@ -388,8 +376,8 @@ def get_base_link_args(target: 'BuildTarget',
388376 except (KeyError , AttributeError ):
389377 pass
390378
391- as_needed = option_enabled ( linker . base_options , target , env , 'b_asneeded' )
392- bitcode = option_enabled ( linker . base_options , target , env , 'b_bitcode' )
379+ as_needed = env . coredata . optstore . get_option_for_target ( target , OptionKey ( 'b_asneeded' ), bool , default = False )
380+ bitcode = env . coredata . optstore . get_option_for_target ( target , OptionKey ( 'b_bitcode' ), bool , default = False )
393381 # Shared modules cannot be built with bitcode_bundle because
394382 # -bitcode_bundle is incompatible with -undefined and -bundle
395383 if bitcode and not target .typename == 'shared module' :
@@ -404,7 +392,7 @@ def get_base_link_args(target: 'BuildTarget',
404392 from ..build import SharedModule
405393 args .extend (linker .headerpad_args ())
406394 if (not isinstance (target , SharedModule ) and
407- option_enabled ( linker . base_options , target , env , 'b_lundef' )):
395+ env . coredata . optstore . get_option_for_target ( target , OptionKey ( 'b_lundef' ), bool , default = False )):
408396 args .extend (linker .no_undefined_link_args ())
409397 else :
410398 args .extend (linker .get_allow_undefined_link_args ())
0 commit comments