diff options
author | Xinliang David Li <davidxl@google.com> | 2017-08-15 03:13:01 +0000 |
---|---|---|
committer | Xinliang David Li <davidxl@google.com> | 2017-08-15 03:13:01 +0000 |
commit | 237a4de6d7bb4234853740591cea82f8d2d603ff (patch) | |
tree | 4a1c461c5bfa8e8c11bc61f3af88bd952c379851 /lib | |
parent | 6a52c89fd901ed4e70aa567e99488f380afbbc67 (diff) |
Revert r310857 due to internal test failure
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310907 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/profile/InstrProfilingFile.c | 28 | ||||
-rw-r--r-- | lib/profile/InstrProfilingUtil.c | 3 |
2 files changed, 12 insertions, 19 deletions
diff --git a/lib/profile/InstrProfilingFile.c b/lib/profile/InstrProfilingFile.c index ddfa39225..d038bb9cb 100644 --- a/lib/profile/InstrProfilingFile.c +++ b/lib/profile/InstrProfilingFile.c @@ -513,29 +513,23 @@ const char *__llvm_profile_get_path_prefix(void) { COMPILER_RT_VISIBILITY void __llvm_profile_initialize_file(void) { const char *EnvFilenamePat; + const char *SelectedPat = NULL; + ProfileNameSpecifier PNS = PNS_unknown; int hasCommandLineOverrider = (INSTR_PROF_PROFILE_NAME_VAR[0] != 0); EnvFilenamePat = getFilenamePatFromEnv(); - if (EnvFilenamePat) - parseAndSetFilename(EnvFilenamePat, PNS_environment, 0); - else if (hasCommandLineOverrider) { - const char *SelectedPat = INSTR_PROF_PROFILE_NAME_VAR; - - size_t PrefixLen; - int StripLen; - const char *Prefix = lprofGetPathPrefix(&StripLen, &PrefixLen); - if (Prefix != NULL) { - char *StripPat = - COMPILER_RT_ALLOCA(PrefixLen + 1 + strlen(SelectedPat) + 1); - lprofApplyPathPrefix(StripPat, SelectedPat, Prefix, PrefixLen, StripLen); - SelectedPat = StripPat; - } - - parseAndSetFilename(SelectedPat, PNS_command_line, Prefix ? 1 : 0); + if (EnvFilenamePat) { + SelectedPat = EnvFilenamePat; + PNS = PNS_environment; + } else if (hasCommandLineOverrider) { + SelectedPat = INSTR_PROF_PROFILE_NAME_VAR; + PNS = PNS_command_line; } else { - parseAndSetFilename(NULL, PNS_default, 0); + SelectedPat = NULL; + PNS = PNS_default; } + parseAndSetFilename(SelectedPat, PNS, 0); } /* This API is directly called by the user application code. It has the diff --git a/lib/profile/InstrProfilingUtil.c b/lib/profile/InstrProfilingUtil.c index bed97e526..fb68f30a5 100644 --- a/lib/profile/InstrProfilingUtil.c +++ b/lib/profile/InstrProfilingUtil.c @@ -196,8 +196,7 @@ lprofApplyPathPrefix(char *Dest, const char *PathStr, const char *Prefix, memcpy(Dest, Prefix, PrefixLen); - if (!IS_DIR_SEPARATOR(Prefix[PrefixLen - 1]) && - !IS_DIR_SEPARATOR(StrippedPathStr[0])) + if (!IS_DIR_SEPARATOR(Prefix[PrefixLen - 1])) Dest[PrefixLen++] = DIR_SEPARATOR; memcpy(Dest + PrefixLen, StrippedPathStr, strlen(StrippedPathStr) + 1); |