1 //===-- Optimizer/Support/FatalError.h --------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // Coding style: https://mlir.llvm.org/getting_started/DeveloperGuide/ 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef FORTRAN_OPTIMIZER_SUPPORT_FATALERROR_H 14 #define FORTRAN_OPTIMIZER_SUPPORT_FATALERROR_H 15 16 #include "mlir/IR/Diagnostics.h" 17 #include "llvm/Support/ErrorHandling.h" 18 19 namespace fir { 20 21 /// Fatal error reporting helper. Report a fatal error with a source location 22 /// and immediately abort flang. emitFatalError(mlir::Location loc,const llvm::Twine & message)23[[noreturn]] inline void emitFatalError(mlir::Location loc, 24 const llvm::Twine &message) { 25 mlir::emitError(loc, message); 26 llvm::report_fatal_error("aborting"); 27 } 28 29 } // namespace fir 30 31 #endif // FORTRAN_OPTIMIZER_SUPPORT_FATALERROR_H 32