[llvm] f6fa95b - [Support] ErrorHandling.h - Remove report_fatal_error(std::string)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 6 06:32:49 PDT 2021


Author: Simon Pilgrim
Date: 2021-10-06T14:32:38+01:00
New Revision: f6fa95b77f33c3690e4201e505cb8dce1433abd9

URL: https://github.com/llvm/llvm-project/commit/f6fa95b77f33c3690e4201e505cb8dce1433abd9
DIFF: https://github.com/llvm/llvm-project/commit/f6fa95b77f33c3690e4201e505cb8dce1433abd9.diff

LOG: [Support] ErrorHandling.h - Remove report_fatal_error(std::string)

As described on D111049, removing the <string> dependency from error handling removes considerable build overhead, its recommended that the report_fatal_error(Twine) variant is used instead.

Added: 
    

Modified: 
    llvm/include/llvm/Support/ErrorHandling.h
    llvm/lib/Support/ErrorHandling.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/ErrorHandling.h b/llvm/include/llvm/Support/ErrorHandling.h
index 260c76fadc95..f980510d37f0 100644
--- a/llvm/include/llvm/Support/ErrorHandling.h
+++ b/llvm/include/llvm/Support/ErrorHandling.h
@@ -15,7 +15,6 @@
 #define LLVM_SUPPORT_ERRORHANDLING_H
 
 #include "llvm/Support/Compiler.h"
-#include <string>
 
 namespace llvm {
   class StringRef;
@@ -68,10 +67,9 @@ namespace llvm {
 /// standard error, followed by a newline.
 /// After the error handler is called this function will call abort(), it
 /// does not return.
+/// NOTE: The std::string variant was removed to avoid a <string> dependency.
 [[noreturn]] void report_fatal_error(const char *reason,
                                      bool gen_crash_diag = true);
-[[noreturn]] void report_fatal_error(const std::string &reason,
-                                     bool gen_crash_diag = true);
 [[noreturn]] void report_fatal_error(StringRef reason,
                                      bool gen_crash_diag = true);
 [[noreturn]] void report_fatal_error(const Twine &reason,

diff  --git a/llvm/lib/Support/ErrorHandling.cpp b/llvm/lib/Support/ErrorHandling.cpp
index b15c36f5b9e5..433417a23245 100644
--- a/llvm/lib/Support/ErrorHandling.cpp
+++ b/llvm/lib/Support/ErrorHandling.cpp
@@ -83,10 +83,6 @@ void llvm::report_fatal_error(const char *Reason, bool GenCrashDiag) {
   report_fatal_error(Twine(Reason), GenCrashDiag);
 }
 
-void llvm::report_fatal_error(const std::string &Reason, bool GenCrashDiag) {
-  report_fatal_error(Twine(Reason), GenCrashDiag);
-}
-
 void llvm::report_fatal_error(StringRef Reason, bool GenCrashDiag) {
   report_fatal_error(Twine(Reason), GenCrashDiag);
 }


        


More information about the llvm-commits mailing list