[pkg-d-commits] [ldc] 110/149: profile-rt: update LLVM 5.0 copy.

Matthias Klumpp mak at moszumanska.debian.org
Sun Apr 23 22:37:03 UTC 2017


This is an automated email from the git hooks/post-receive script.

mak pushed a commit to annotated tag v1.2.0
in repository ldc.

commit 8b25e459da93afb5e69272986f781523d8cb87a8
Author: Johan Engelen <jbc.engelen at gmail.com>
Date:   Thu Feb 23 21:45:04 2017 +0100

    profile-rt: update LLVM 5.0 copy.
---
 .../profile-rt/profile-rt-50/InstrProfilingFile.c    | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/runtime/profile-rt/profile-rt-50/InstrProfilingFile.c b/runtime/profile-rt/profile-rt-50/InstrProfilingFile.c
index f82080c..cd3590e 100644
--- a/runtime/profile-rt/profile-rt-50/InstrProfilingFile.c
+++ b/runtime/profile-rt/profile-rt-50/InstrProfilingFile.c
@@ -172,6 +172,16 @@ static int doProfileMerging(FILE *ProfileFile) {
   return 0;
 }
 
+/* Create the directory holding the file, if needed. */
+static void createProfileDir(const char *Filename) {
+  size_t Length = strlen(Filename);
+  if (lprofFindFirstDirSeparator(Filename)) {
+    char *Copy = (char *)COMPILER_RT_ALLOCA(Length + 1);
+    strncpy(Copy, Filename, Length + 1);
+    __llvm_profile_recursive_mkdir(Copy);
+  }
+}
+
 /* Open the profile data for merging. It opens the file in r+b mode with
  * file locking.  If the file has content which is compatible with the
  * current process, it also reads in the profile data in the file and merge
@@ -184,6 +194,7 @@ static FILE *openFileForMerging(const char *ProfileFileName) {
   FILE *ProfileFile;
   int rc;
 
+  createProfileDir(ProfileFileName);
   ProfileFile = lprofOpenFileEx(ProfileFileName);
   if (!ProfileFile)
     return NULL;
@@ -233,18 +244,13 @@ static void truncateCurrentFile(void) {
   if (!Filename)
     return;
 
-  /* Create the directory holding the file, if needed. */
-  if (lprofFindFirstDirSeparator(Filename)) {
-    char *Copy = (char *)COMPILER_RT_ALLOCA(Length + 1);
-    strncpy(Copy, Filename, Length + 1);
-    __llvm_profile_recursive_mkdir(Copy);
-  }
-
   /* By pass file truncation to allow online raw profile
    * merging. */
   if (lprofCurFilename.MergePoolSize)
     return;
 
+  createProfileDir(Filename);
+
   /* Truncate the file.  Later we'll reopen and append. */
   File = fopen(Filename, "w");
   if (!File)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/ldc.git



More information about the pkg-d-commits mailing list