forked from OSchip/llvm-project
Try to use the CWD if the path to the GCDA output is not available (e.g., the
executable has been moved to another machine). If that's not available (read-only or something), then exit gracefully. <rdar://problem/11111686> llvm-svn: 153538
This commit is contained in:
parent
741f3f9a55
commit
79f9bc04ab
|
@ -113,6 +113,20 @@ void llvm_gcda_start_file(const char *orig_filename) {
|
|||
recursive_mkdir(filename);
|
||||
output_file = fopen(filename, "wb");
|
||||
|
||||
if (!output_file) {
|
||||
filename[0] = '\0'; /* The size of filename should be big enough. */
|
||||
char *cptr = strrchr(orig_filename, '/');
|
||||
strcat(filename, cptr ? cptr + 1 : orig_filename);
|
||||
output_file = fopen(filename, "wb");
|
||||
|
||||
if (!output_file) {
|
||||
fprintf(stderr, "LLVM profiling runtime: while opening '%s': ",
|
||||
filename);
|
||||
perror("");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* gcda file, version 404*, stamp LLVM. */
|
||||
#ifdef __APPLE__
|
||||
fwrite("adcg*204MVLL", 12, 1, output_file);
|
||||
|
|
Loading…
Reference in New Issue