diff options
author | dim <dim@FreeBSD.org> | 2012-04-14 13:54:10 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-04-14 13:54:10 +0000 |
commit | 1fc08f5e9ef733ef1ce6f363fecedc2260e78974 (patch) | |
tree | 19c69a04768629f2d440944b71cbe90adae0b615 /runtime/libprofile/GCDAProfiling.c | |
parent | 07637c87f826cdf411f0673595e9bc92ebd793f2 (diff) | |
download | FreeBSD-src-1fc08f5e9ef733ef1ce6f363fecedc2260e78974.zip FreeBSD-src-1fc08f5e9ef733ef1ce6f363fecedc2260e78974.tar.gz |
Vendor import of llvm trunk r154661:
http://llvm.org/svn/llvm-project/llvm/trunk@r154661
Diffstat (limited to 'runtime/libprofile/GCDAProfiling.c')
-rw-r--r-- | runtime/libprofile/GCDAProfiling.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/runtime/libprofile/GCDAProfiling.c b/runtime/libprofile/GCDAProfiling.c index 4ffb12b..3a48bb2 100644 --- a/runtime/libprofile/GCDAProfiling.c +++ b/runtime/libprofile/GCDAProfiling.c @@ -113,6 +113,18 @@ void llvm_gcda_start_file(const char *orig_filename) { recursive_mkdir(filename); output_file = fopen(filename, "wb"); + if (!output_file) { + const char *cptr = strrchr(orig_filename, '/'); + output_file = fopen(cptr ? cptr + 1 : orig_filename, "wb"); + + if (!output_file) { + fprintf(stderr, "LLVM profiling runtime: while opening '%s': ", + cptr ? cptr + 1 : orig_filename); + perror(""); + exit(1); + } + } + /* gcda file, version 404*, stamp LLVM. */ #ifdef __APPLE__ fwrite("adcg*204MVLL", 12, 1, output_file); |