[llvm] e9f4fa7 - [llvm] Unix.h - Replace report_fatal_error(std::string) with report_fatal_error(Twine)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 6 04:13:50 PDT 2021


Author: Simon Pilgrim
Date: 2021-10-06T12:13:40+01:00
New Revision: e9f4fa75ed19a075593928644de92b398345772a

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

LOG: [llvm] Unix.h - Replace report_fatal_error(std::string) with report_fatal_error(Twine)

As described on D111049, we're trying to remove the <string> dependency from error handling and replace uses of report_fatal_error(const std::string&) with the Twine() variant which can be forward declared.

Added: 
    

Modified: 
    llvm/lib/Support/Unix/Unix.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/Unix/Unix.h b/llvm/lib/Support/Unix/Unix.h
index e3924345ddb58..1599241a344af 100644
--- a/llvm/lib/Support/Unix/Unix.h
+++ b/llvm/lib/Support/Unix/Unix.h
@@ -70,7 +70,7 @@ static inline bool MakeErrMsg(
 [[noreturn]] static inline void ReportErrnumFatal(const char *Msg, int errnum) {
   std::string ErrMsg;
   MakeErrMsg(&ErrMsg, Msg, errnum);
-  llvm::report_fatal_error(ErrMsg);
+  llvm::report_fatal_error(llvm::Twine(ErrMsg));
 }
 
 namespace llvm {


        


More information about the llvm-commits mailing list