Skip to content

Commit 34b220b

Browse files
author
Michael Boldt
committed
Avoid removing -Xclang options when removing link options.
1 parent e4bd86b commit 34b220b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

driver/utils.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,17 @@ def buildObject(builder):
310310
def isLinkOption(arg):
311311
return arg == '-pthread' or arg.startswith('-l') or arg.startswith('-Wl,')
312312

313+
def removeLinkOptions(args):
314+
filtered = []
315+
prevarg = None
316+
for arg in args:
317+
if "-Xclang" == prevarg:
318+
filtered += [arg]
319+
elif not isLinkOption(arg):
320+
filtered += [arg]
321+
prevarg = arg
322+
return filtered
323+
313324
# This command does not have the executable with it
314325
def buildAndAttachBitcode(builder):
315326
af = builder.getBitcodeArglistFilter()
@@ -324,7 +335,7 @@ def buildAndAttachBitcode(builder):
324335
# check to see if there was any output on stderr instead of the
325336
# return code of commands, so warnings about unused link flags can
326337
# cause spurious failures here.
327-
bcc = [arg for arg in bcc if not isLinkOption(arg)]
338+
bcc = removeLinkOptions(bcc)
328339
proc = Popen(bcc)
329340
rc = proc.wait()
330341
if rc == 0:

0 commit comments

Comments
 (0)