[Profile] create a copy of profile file name from environment

Original patch by Max Moroz.

Differential Revsion: http://reviews.llvm.org/D36903

llvm-svn: 311607
This commit is contained in:
Xinliang David Li 2017-08-23 21:39:33 +00:00
parent a845167dca
commit c7c5303fa3
1 changed files with 4 additions and 2 deletions

View File

@ -519,8 +519,10 @@ void __llvm_profile_initialize_file(void) {
EnvFilenamePat = getFilenamePatFromEnv(); EnvFilenamePat = getFilenamePatFromEnv();
if (EnvFilenamePat) { if (EnvFilenamePat) {
SelectedPat = EnvFilenamePat; /* Pass CopyFilenamePat = 1, to ensure that the filename would be valid
PNS = PNS_environment; at the moment when __llvm_profile_write_file() gets executed. */
parseAndSetFilename(EnvFilenamePat, PNS_environment, 1);
return;
} else if (hasCommandLineOverrider) { } else if (hasCommandLineOverrider) {
SelectedPat = INSTR_PROF_PROFILE_NAME_VAR; SelectedPat = INSTR_PROF_PROFILE_NAME_VAR;
PNS = PNS_command_line; PNS = PNS_command_line;