diff options
| author | Bill Wendling <isanbard@gmail.com> | 2012-05-25 00:55:38 +0000 |
|---|---|---|
| committer | Bill Wendling <isanbard@gmail.com> | 2012-05-25 00:55:38 +0000 |
| commit | fec1fc3b851313154b26e1be445806e877aae04e (patch) | |
| tree | 40a145a09b0b07e9e03e00aa773dd3da5dd956ca | |
| parent | 49ea89ee2de12272b5d7238ebc9c2dd3fcfd55c0 (diff) | |
| download | bcm5719-llvm-fec1fc3b851313154b26e1be445806e877aae04e.tar.gz bcm5719-llvm-fec1fc3b851313154b26e1be445806e877aae04e.zip | |
Don't call exit from a runtime.
llvm-svn: 157450
| -rw-r--r-- | llvm/runtime/libprofile/GCDAProfiling.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/runtime/libprofile/GCDAProfiling.c b/llvm/runtime/libprofile/GCDAProfiling.c index 3a48bb28265..568b2b0faa4 100644 --- a/llvm/runtime/libprofile/GCDAProfiling.c +++ b/llvm/runtime/libprofile/GCDAProfiling.c @@ -121,7 +121,7 @@ void llvm_gcda_start_file(const char *orig_filename) { fprintf(stderr, "LLVM profiling runtime: while opening '%s': ", cptr ? cptr + 1 : orig_filename); perror(""); - exit(1); + return; } } @@ -167,6 +167,7 @@ void llvm_gcda_emit_function(uint32_t ident, const char *function_name) { #ifdef DEBUG_GCDAPROFILING printf("llvmgcda: function id=%x\n", ident); #endif + if (!output_file) return; /* function tag */ 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) { uint32_t i; - /* counter #1 (arcs) tag */ + + /* Counter #1 (arcs) tag */ + if (!output_file) return; fwrite("\0\0\xa1\1", 4, 1, output_file); write_int32(num_counters * 2); 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() { /* Write out EOF record. */ + if (!output_file) return; fwrite("\0\0\0\0\0\0\0\0", 8, 1, output_file); fclose(output_file); output_file = NULL; |

