Debugging a missing profile is a bit painful right now. We can make
people's lives a bit easier by adding a knob to enable printing a
helpful error message for such failures.
llvm-svn: 226312
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/errno.h>
#define UNCONST(ptr) ((void *)(uintptr_t)(ptr))
return -1;
/* Write the file. */
- return writeFileWithName(__llvm_profile_CurrentFilename);
+ int rc = writeFileWithName(__llvm_profile_CurrentFilename);
+ if (rc && getenv("LLVM_PROFILE_VERBOSE_ERRORS"))
+ fprintf(stderr, "LLVM Profile: Failed to write file \"%s\": %s\n",
+ __llvm_profile_CurrentFilename, strerror(errno));
+ return rc;
}
static void writeFileWithoutReturn(void) {