Don't call exit from a runtime.

llvm-svn: 157450
This commit is contained in:
Bill Wendling 2012-05-25 00:55:38 +00:00
parent 49ea89ee2d
commit fec1fc3b85
1 changed files with 6 additions and 2 deletions

View File

@ -121,7 +121,7 @@ void llvm_gcda_start_file(const char *orig_filename) {
fprintf(stderr, "LLVM profiling runtime: while opening '%s': ", fprintf(stderr, "LLVM profiling runtime: while opening '%s': ",
cptr ? cptr + 1 : orig_filename); cptr ? cptr + 1 : orig_filename);
perror(""); perror("");
exit(1); return;
} }
} }
@ -167,6 +167,7 @@ void llvm_gcda_emit_function(uint32_t ident, const char *function_name) {
#ifdef DEBUG_GCDAPROFILING #ifdef DEBUG_GCDAPROFILING
printf("llvmgcda: function id=%x\n", ident); printf("llvmgcda: function id=%x\n", ident);
#endif #endif
if (!output_file) return;
/* function tag */ /* function tag */
fwrite("\0\0\0\1", 4, 1, output_file); fwrite("\0\0\0\1", 4, 1, output_file);
@ -179,7 +180,9 @@ void llvm_gcda_emit_function(uint32_t ident, const char *function_name) {
void llvm_gcda_emit_arcs(uint32_t num_counters, uint64_t *counters) { void llvm_gcda_emit_arcs(uint32_t num_counters, uint64_t *counters) {
uint32_t i; uint32_t i;
/* counter #1 (arcs) tag */
/* Counter #1 (arcs) tag */
if (!output_file) return;
fwrite("\0\0\xa1\1", 4, 1, output_file); fwrite("\0\0\xa1\1", 4, 1, output_file);
write_int32(num_counters * 2); write_int32(num_counters * 2);
for (i = 0; i < num_counters; ++i) { for (i = 0; i < num_counters; ++i) {
@ -196,6 +199,7 @@ void llvm_gcda_emit_arcs(uint32_t num_counters, uint64_t *counters) {
void llvm_gcda_end_file() { void llvm_gcda_end_file() {
/* Write out EOF record. */ /* Write out EOF record. */
if (!output_file) return;
fwrite("\0\0\0\0\0\0\0\0", 8, 1, output_file); fwrite("\0\0\0\0\0\0\0\0", 8, 1, output_file);
fclose(output_file); fclose(output_file);
output_file = NULL; output_file = NULL;