[llvm] 59d04ce - [MC] Remove MCContext::reportFatalError

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 15 00:42:45 PST 2022


Author: Fangrui Song
Date: 2022-01-15T00:42:42-08:00
New Revision: 59d04ce639baa87255b49e4a4f96348bc24ed2c5

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

LOG: [MC] Remove MCContext::reportFatalError

As the 10-year-old FIXME comment says, this API is not recommended.

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCContext.h
    llvm/lib/MC/MCContext.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCContext.h b/llvm/include/llvm/MC/MCContext.h
index bde750759a0ba..88d86d5b675ac 100644
--- a/llvm/include/llvm/MC/MCContext.h
+++ b/llvm/include/llvm/MC/MCContext.h
@@ -814,10 +814,6 @@ namespace llvm {
     void diagnose(const SMDiagnostic &SMD);
     void reportError(SMLoc L, const Twine &Msg);
     void reportWarning(SMLoc L, const Twine &Msg);
-    // Unrecoverable error has occurred. Display the best diagnostic we can
-    // and bail via exit(1). For now, most MC backend errors are unrecoverable.
-    // FIXME: We should really do something about that.
-    [[noreturn]] void reportFatalError(SMLoc L, const Twine &Msg);
 
     const MCAsmMacro *lookupMacro(StringRef Name) {
       StringMap<MCAsmMacro>::iterator I = MacroMap.find(Name);

diff  --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index aa4051aa24005..7f639e9c408fe 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -978,13 +978,3 @@ void MCContext::reportWarning(SMLoc Loc, const Twine &Msg) {
     });
   }
 }
-
-void MCContext::reportFatalError(SMLoc Loc, const Twine &Msg) {
-  reportError(Loc, Msg);
-
-  // If we reached here, we are failing ungracefully. Run the interrupt handlers
-  // to make sure any special cleanups get done, in particular that we remove
-  // files registered with RemoveFileOnSignal.
-  sys::RunInterruptHandlers();
-  exit(1);
-}


        


More information about the llvm-commits mailing list