Skip to content

Commit

Permalink
[emcc.py] Avoid searching argument list in phase_compile_inputs. NFC (#…
Browse files Browse the repository at this point in the history
…23450)

We already parsed the arguments so we can check the options struct
instead of doing `in newargs`.
  • Loading branch information
sbc100 authored Jan 17, 2025
1 parent 1dcba61 commit 0f6b437
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def __init__(self):
self.executable = False
self.compiler_wrapper = None
self.oformat = None
self.requested_debug = ''
self.requested_debug = None
self.emit_symbol_map = False
self.use_closure_compiler = None
self.closure_args = []
Expand Down Expand Up @@ -949,7 +949,7 @@ def is_link_flag(flag):


@ToolchainProfiler.profile_block('compile inputs')
def phase_compile_inputs(options, state, newargs, input_files):
def phase_compile_inputs(options, state, compile_args, input_files):
if shared.run_via_emxx:
compiler = [shared.CLANG_CXX]
else:
Expand All @@ -959,7 +959,6 @@ def phase_compile_inputs(options, state, newargs, input_files):
logger.debug('using compiler wrapper: %s', config.COMPILER_WRAPPER)
compiler.insert(0, config.COMPILER_WRAPPER)

compile_args = newargs
system_libs.ensure_sysroot()

def get_language_mode(args):
Expand All @@ -974,7 +973,7 @@ def get_language_mode(args):
return removeprefix(item, '-x')
return ''

language_mode = get_language_mode(newargs)
language_mode = get_language_mode(compile_args)
use_cxx = 'c++' in language_mode or shared.run_via_emxx

def get_clang_command():
Expand Down Expand Up @@ -1054,7 +1053,7 @@ def compile_source_file(i, input_file):
if get_file_suffix(input_file) in ['.pcm']:
cmd = [c for c in cmd if not c.startswith('-fprebuilt-module-path=')]
cmd += ['-c', input_file, '-o', output_file]
if state.mode == Mode.COMPILE_AND_LINK and '-gsplit-dwarf' in newargs:
if state.mode == Mode.COMPILE_AND_LINK and options.requested_debug == '-gsplit-dwarf':
# When running in COMPILE_AND_LINK mode we compile to temporary location
# but we want the `.dwo` file to be generated in the current working directory,
# like it is under clang. We could avoid this hack if we use the clang driver
Expand Down

0 comments on commit 0f6b437

Please sign in to comment.