[compiler-rt] r311607 - [Profile] create a copy of profile file name from environment

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 23 14:39:33 PDT 2017


Author: davidxl
Date: Wed Aug 23 14:39:33 2017
New Revision: 311607

URL: http://llvm.org/viewvc/llvm-project?rev=311607&view=rev
Log:
[Profile] create a copy of profile file name from environment

Original patch by Max Moroz.

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

Modified:
    compiler-rt/trunk/lib/profile/InstrProfilingFile.c

Modified: compiler-rt/trunk/lib/profile/InstrProfilingFile.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingFile.c?rev=311607&r1=311606&r2=311607&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingFile.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingFile.c Wed Aug 23 14:39:33 2017
@@ -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;




More information about the llvm-commits mailing list