From 65adec933ddca720b52c34d53777acd5f92a5cb1 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Mon, 28 May 2012 09:46:43 +0000 Subject: [PATCH] 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. llvm-svn: 157572 --- compiler-rt/lib/profile/GCDAProfiling.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/compiler-rt/lib/profile/GCDAProfiling.c b/compiler-rt/lib/profile/GCDAProfiling.c index 1126787..4d0c41b 100644 --- a/compiler-rt/lib/profile/GCDAProfiling.c +++ b/compiler-rt/lib/profile/GCDAProfiling.c @@ -113,21 +113,10 @@ void llvm_gcda_start_file(const char *orig_filename) { 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; } } -- 2.7.4