llvm.org GIT mirror llvm / 66e30f8
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> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153538 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 8 years ago
1 changed file(s) with 14 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
112112 recursive_mkdir(filename);
113113 output_file = fopen(filename, "wb");
114114
115 if (!output_file) {
116 filename[0] = '\0'; /* The size of filename should be big enough. */
117 char *cptr = strrchr(orig_filename, '/');
118 strcat(filename, cptr ? cptr + 1 : orig_filename);
119 output_file = fopen(filename, "wb");
120
121 if (!output_file) {
122 fprintf(stderr, "LLVM profiling runtime: while opening '%s': ",
123 filename);
124 perror("");
125 exit(1);
126 }
127 }
128
115129 /* gcda file, version 404*, stamp LLVM. */
116130 #ifdef __APPLE__
117131 fwrite("adcg*204MVLL", 12, 1, output_file);