[flang-commits] [flang] 93ee588 - [flang] Rename the runtime routine that reports a fatal user error

Peter Steinfeld via flang-commits flang-commits at lists.llvm.org
Tue Feb 1 09:02:54 PST 2022


Author: Peter Steinfeld
Date: 2022-02-01T09:01:50-08:00
New Revision: 93ee588232877485535f40e56014eb0e12e3fa32

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

LOG: [flang] Rename the runtime routine that reports a fatal user error

As per Steve Scalpone's suggestion, I've renamed the runtime routine to
better evoke its purpose.

I implemented a routine called "Crash" and added a test.

Differential Revision: https://reviews.llvm.org/D118703

Added: 
    

Modified: 
    flang/include/flang/Runtime/stop.h
    flang/runtime/stop.cpp
    flang/unittests/Runtime/Stop.cpp

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Runtime/stop.h b/flang/include/flang/Runtime/stop.h
index b129734d3432f..cf5ee7bcf4095 100644
--- a/flang/include/flang/Runtime/stop.h
+++ b/flang/include/flang/Runtime/stop.h
@@ -32,7 +32,8 @@ NORETURN void RTNAME(Abort)(NO_ARGUMENTS);
 
 // Crash with an error message when the program dynamically violates a Fortran
 // constraint.
-NORETURN void RTNAME(Crash)(const char *message, const char *source, int line);
+NORETURN void RTNAME(ReportFatalUserError)(
+    const char *message, const char *source, int line);
 
 FORTRAN_EXTERN_C_END
 

diff  --git a/flang/runtime/stop.cpp b/flang/runtime/stop.cpp
index 8d43ad8593c1d..7bbbf907cab24 100644
--- a/flang/runtime/stop.cpp
+++ b/flang/runtime/stop.cpp
@@ -144,7 +144,7 @@ void RTNAME(PauseStatementText)(const char *code, std::size_t length) {
 
 [[noreturn]] void RTNAME(Abort)() { std::abort(); }
 
-[[noreturn]] void RTNAME(Crash)(
+[[noreturn]] void RTNAME(ReportFatalUserError)(
     const char *message, const char *source, int line) {
   Fortran::runtime::Terminator{source, line}.Crash(message);
 }

diff  --git a/flang/unittests/Runtime/Stop.cpp b/flang/unittests/Runtime/Stop.cpp
index ace69bf5ee256..9d962bf7aa77d 100644
--- a/flang/unittests/Runtime/Stop.cpp
+++ b/flang/unittests/Runtime/Stop.cpp
@@ -91,6 +91,7 @@ TEST(TestProgramEnd, CrashTest) {
   static const std::string tailMessage{":343\\): "};
   static const std::string fullMessage{
       headMessage + fileName + tailMessage + crashMessage};
-  EXPECT_DEATH(RTNAME(Crash)(crashMessage.c_str(), fileName.c_str(), 343),
+  EXPECT_DEATH(
+      RTNAME(ReportFatalUserError)(crashMessage.c_str(), fileName.c_str(), 343),
       fullMessage.c_str());
 }


        


More information about the flang-commits mailing list