[llvm-commits] [compiler-rt] r157572 - /compiler-rt/trunk/lib/profile/GCDAProfiling.c

Bill Wendling isanbard at gmail.com
Mon May 28 02:46:43 PDT 2012


Author: void
Date: Mon May 28 04:46:43 2012
New Revision: 157572

URL: http://llvm.org/viewvc/llvm-project?rev=157572&view=rev
Log:
Simplify the logic that tries to open the GCDA file at all costs. Basically, if
we can't open the file even after creating all of the directories to it, then
just give up.

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

Modified: compiler-rt/trunk/lib/profile/GCDAProfiling.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/GCDAProfiling.c?rev=157572&r1=157571&r2=157572&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/GCDAProfiling.c (original)
+++ compiler-rt/trunk/lib/profile/GCDAProfiling.c Mon May 28 04:46:43 2012
@@ -113,21 +113,10 @@
   output_file = fopen(filename, "w+b");
 
   if (!output_file) {
-    int len = strlen(orig_filename) - 1;
     recursive_mkdir(filename);
-
-    for (; len >= 0 && orig_filename[len] != '/'; --len)
-      /* empty */;
-
-    if (len < 0)
-      len = 0;
-    else if (orig_filename[len] == '/')
-      ++len;
-
-    output_file = fopen(&orig_filename[len], "w+b");
-
+    output_file = fopen(filename, "w+b");
     if (!output_file) {
-      fprintf(stderr, "profiling:%s: cannot open\n", &orig_filename[len]);
+      fprintf(stderr, "profiling:%s: cannot open\n", filename);
       return;
     }
   }





More information about the llvm-commits mailing list