diff options
author | Xinliang David Li <davidxl@google.com> | 2017-08-23 21:39:33 +0000 |
---|---|---|
committer | Xinliang David Li <davidxl@google.com> | 2017-08-23 21:39:33 +0000 |
commit | 6c8e0272792ff33e494ab3ea0e3c264e1d2abadf (patch) | |
tree | 759793c3302a869275a72c6c37ee64e4f82f90b1 /lib/profile/InstrProfilingFile.c | |
parent | 4854a215fc3c0b10ab57b4b9b5e4cbeb5bf0624a (diff) |
[Profile] create a copy of profile file name from environment
Original patch by Max Moroz.
Differential Revsion: http://reviews.llvm.org/D36903
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311607 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/profile/InstrProfilingFile.c')
-rw-r--r-- | lib/profile/InstrProfilingFile.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/profile/InstrProfilingFile.c b/lib/profile/InstrProfilingFile.c index d038bb9cb..8ae2b7d98 100644 --- a/lib/profile/InstrProfilingFile.c +++ b/lib/profile/InstrProfilingFile.c @@ -519,8 +519,10 @@ void __llvm_profile_initialize_file(void) { EnvFilenamePat = getFilenamePatFromEnv(); if (EnvFilenamePat) { - SelectedPat = EnvFilenamePat; - PNS = PNS_environment; + /* Pass CopyFilenamePat = 1, to ensure that the filename would be valid + at the moment when __llvm_profile_write_file() gets executed. */ + parseAndSetFilename(EnvFilenamePat, PNS_environment, 1); + return; } else if (hasCommandLineOverrider) { SelectedPat = INSTR_PROF_PROFILE_NAME_VAR; PNS = PNS_command_line; |