forked from OSchip/llvm-project
[profile] PROF_ERR, PROF_WARN
1) Move common prefix to the macro def 2) Introduced PROF_WARN 3) Make error message unconditionally printed out. llvm-svn: 270185
This commit is contained in:
parent
13b47a96da
commit
690c31f104
|
@ -228,13 +228,13 @@ int __llvm_profile_write_file(void) {
|
|||
GetEnvHook = &getenv;
|
||||
/* Check the filename. */
|
||||
if (!__llvm_profile_CurrentFilename) {
|
||||
PROF_ERR("LLVM Profile: Failed to write file : %s\n", "Filename not set");
|
||||
PROF_ERR("Failed to write file : %s\n", "Filename not set");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Check if there is llvm/runtime version mismatch. */
|
||||
if (GET_VERSION(__llvm_profile_get_version()) != INSTR_PROF_RAW_VERSION) {
|
||||
PROF_ERR("LLVM Profile: runtime and instrumentation version mismatch : "
|
||||
PROF_ERR("Runtime and instrumentation version mismatch : "
|
||||
"expected %d, but get %d\n",
|
||||
INSTR_PROF_RAW_VERSION,
|
||||
(int)GET_VERSION(__llvm_profile_get_version()));
|
||||
|
@ -244,7 +244,7 @@ int __llvm_profile_write_file(void) {
|
|||
/* Write the file. */
|
||||
rc = writeFileWithName(__llvm_profile_CurrentFilename);
|
||||
if (rc)
|
||||
PROF_ERR("LLVM Profile: Failed to write file \"%s\": %s\n",
|
||||
PROF_ERR("Failed to write file \"%s\": %s\n",
|
||||
__llvm_profile_CurrentFilename, strerror(errno));
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -70,8 +70,10 @@
|
|||
#endif
|
||||
|
||||
#define PROF_ERR(Format, ...) \
|
||||
if (GetEnvHook && GetEnvHook("LLVM_PROFILE_VERBOSE_ERRORS")) \
|
||||
fprintf(stderr, Format, __VA_ARGS__);
|
||||
fprintf(stderr, "LLVM Profile Error: " Format, __VA_ARGS__);
|
||||
|
||||
#define PROF_WARN(Format, ...) \
|
||||
fprintf(stderr, "LLVM Profile Warning: " Format, __VA_ARGS__);
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// RUN: %clang_profgen -o %t -O3 %s
|
||||
// RUN: env LLVM_PROFILE_FILE=%t/ LLVM_PROFILE_VERBOSE_ERRORS=1 %run %t 1 2>&1 | FileCheck %s
|
||||
// RUN: env LLVM_PROFILE_FILE=%t/ %run %t 1 2>&1 | FileCheck %s
|
||||
|
||||
int main(int argc, const char *argv[]) {
|
||||
if (argc < 2)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
// CHECK: LLVM Profile: Failed to write file
|
||||
// CHECK: LLVM Profile Error: Failed to write file
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: %clang_profgen -o %t -O3 %s
|
||||
// RUN: env LLVM_PROFILE_VERBOSE_ERRORS=1 %run %t 1 2>&1 | FileCheck %s
|
||||
// RUN: %run %t 1 2>&1 | FileCheck %s
|
||||
|
||||
// override the version variable with a bogus version:
|
||||
unsigned long long __llvm_profile_raw_version = 10000;
|
||||
|
@ -8,4 +8,4 @@ int main(int argc, const char *argv[]) {
|
|||
return 1;
|
||||
return 0;
|
||||
}
|
||||
// CHECK: LLVM Profile: runtime and instrumentation version mismatch
|
||||
// CHECK: LLVM Profile Error: Runtime and instrumentation version mismatch
|
||||
|
|
Loading…
Reference in New Issue