Skip to content

Commit 04a01ad

Browse files
committed
Use litsupport.shellcommand to set LLVM_PROFILE_FILE
Differential Revision: https://reviews.llvm.org/D121225
1 parent 80da0f3 commit 04a01ad

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

litsupport/modules/profilegen.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ def _mutateCommandline(context, commandline):
77
"""Adjust runscript to set a different value to the LLVM_PROFILE_FILE
88
environment variable for each execution."""
99
profilefile = context.tmpBase + ".profraw"
10-
prefix = "env LLVM_PROFILE_FILE=%s " % profilefile
1110
context.profilefiles.append(profilefile)
12-
return prefix + commandline
11+
cmd = shellcommand.parse(commandline)
12+
cmd.envvars.update({"LLVM_PROFILE_FILE": profilefile})
13+
return cmd.toCommandline()
1314

1415

1516
def _mutateScript(context, script):

litsupport/shellcommand.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ def toCommandline(self):
3232
if self.workdir is not None:
3333
result += "cd %s && " % quote(self.workdir)
3434

35-
res_list = [self.executable] + self.arguments
36-
result += " ".join(map(quote, res_list))
37-
3835
for key, value in self.envvars.items():
3936
result += "%s=%s " % (key, quote(value))
4037

38+
res_list = [self.executable] + self.arguments
39+
result += " ".join(map(quote, res_list))
40+
4141
if self.stdin is not None:
4242
result += " < %s" % quote(self.stdin)
4343
if self.stdout is not None:

0 commit comments

Comments
 (0)