Skip to content

Commit bb16fac

Browse files
committed
treat the 'take input from standard in' case as a variant of configure only. since presumably thats when it happens.
1 parent 4593a82 commit bb16fac

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

wllvm/arglistfilter.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class ArgumentListFilter(object):
3131
def __init__(self, inputList, exactMatches={}, patternMatches={}):
3232
defaultArgExactMatches = {
3333

34+
'-' : (0, ArgumentListFilter.standardInCallback),
35+
3436
'-o' : (1, ArgumentListFilter.outputFileCallback),
3537
'-c' : (0, ArgumentListFilter.compileOnlyCallback),
3638
'-E' : (0, ArgumentListFilter.preprocessOnlyCallback),
@@ -256,7 +258,7 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
256258
self.isAssembly = False
257259
self.isCompileOnly = False
258260
self.isEmitLLVM = False
259-
261+
self.isStandardIn = False
260262

261263
argExactMatches = dict(defaultArgExactMatches)
262264
argExactMatches.update(exactMatches)
@@ -305,6 +307,11 @@ def _shiftArgs(self, nargs):
305307
nargs = nargs - 1
306308
return ret
307309

310+
311+
def standardInCallback(self, flag):
312+
_logger.debug('standardInCallback: %s', flag)
313+
self.isStandardIn = True
314+
308315
def abortUnaryCallback(self, flag):
309316
_logger.warning('Out of context experience: "%s" "%s"', str(self.inputList), flag)
310317
sys.exit(1)

wllvm/compilers.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,22 @@ def wcompile(mode):
3030
builder = getBuilder(cmd, mode)
3131
rc = buildObject(builder)
3232

33-
if rc == 0 and not os.environ.get('WLLVM_CONFIGURE_ONLY', False):
34-
buildAndAttachBitcode(builder)
33+
# phase one compile failed. no point continuing
34+
if rc != 0:
35+
_logger.info('phase one failed: %s', str(sys.argv))
36+
return rc
37+
38+
# configure only; continuing not desired
39+
if os.environ.get('WLLVM_CONFIGURE_ONLY', False):
40+
return rc
41+
42+
# phase two
43+
buildAndAttachBitcode(builder)
44+
3545
except Exception as e:
3646
_logger.debug('%s: exception case: %s', mode, str(e))
3747

38-
_logger.info('Calling %s returned %d', list(sys.argv), rc)
48+
_logger.info('Calling %s returned %d', list(sys.argv), rc)
3949
return rc
4050

4151

@@ -236,7 +246,8 @@ def buildAndAttachBitcode(builder):
236246

237247
af = builder.getBitcodeArglistFilter()
238248

239-
if not af.inputFiles or af.isEmitLLVM or af.isAssembly or af.isAssembleOnly or (af.isDependencyOnly and not af.isCompileOnly) or af.isPreprocessOnly:
249+
250+
if not af.inputFiles or af.isEmitLLVM or af.isAssembly or af.isAssembleOnly or (af.isDependencyOnly and not af.isCompileOnly) or af.isPreprocessOnly or af.isStandardIn:
240251
_logger.debug('No work to do')
241252
_logger.debug(af.__dict__)
242253
return

0 commit comments

Comments
 (0)