diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2021-10-05 10:51:28 +0100 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2021-10-05 10:55:40 +0100 |
commit | e463b69736da8b0a950ecd937cf990401bdfcdeb (patch) | |
tree | 5e5ae63a38c61ffda4f97f5dbc03633374dff2b1 /llvm/lib/Support/ErrorHandling.cpp | |
parent | 0a031f5c880690e794aad48487dafbb010342ea1 (diff) | |
download | llvm-e463b69736da8b0a950ecd937cf990401bdfcdeb.zip llvm-e463b69736da8b0a950ecd937cf990401bdfcdeb.tar.gz llvm-e463b69736da8b0a950ecd937cf990401bdfcdeb.tar.bz2 |
[Support] Change fatal_error_handler_t to take a const char* instead of std::string
https://commondatastorage.googleapis.com/chromium-browser-clang/llvm-include-analysis.html
Excessive use of the <string> header has a massive impact on compile time; its most commonly included via the ErrorHandling.h header, which has to be included in many key headers, impacting many source files that have no need for std::string.
As an initial step toward removing the <string> include from ErrorHandling.h, this patch proposes to update the fatal_error_handler_t handler to just take a raw const char* instead.
The next step will be to remove the report_fatal_error std::string variant, which will involve a lot of cleanup and better use of Twine/StringRef.
Differential Revision: https://reviews.llvm.org/D111049
Diffstat (limited to 'llvm/lib/Support/ErrorHandling.cpp')
-rw-r--r-- | llvm/lib/Support/ErrorHandling.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Support/ErrorHandling.cpp b/llvm/lib/Support/ErrorHandling.cpp index ce63442..b15c36f 100644 --- a/llvm/lib/Support/ErrorHandling.cpp +++ b/llvm/lib/Support/ErrorHandling.cpp @@ -105,7 +105,7 @@ void llvm::report_fatal_error(const Twine &Reason, bool GenCrashDiag) { } if (handler) { - handler(handlerData, Reason.str(), GenCrashDiag); + handler(handlerData, Reason.str().c_str(), GenCrashDiag); } else { // Blast the result out to stderr. We don't try hard to make sure this // succeeds (e.g. handling EINTR) and we can't use errs() here because @@ -218,11 +218,11 @@ void llvm::llvm_unreachable_internal(const char *msg, const char *file, #endif } -static void bindingsErrorHandler(void *user_data, const std::string& reason, +static void bindingsErrorHandler(void *user_data, const char *reason, bool gen_crash_diag) { LLVMFatalErrorHandler handler = LLVM_EXTENSION reinterpret_cast<LLVMFatalErrorHandler>(user_data); - handler(reason.c_str()); + handler(reason); } void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler) { |