@@ -36,22 +36,22 @@ int CONDITIONAL_ASSERT_Global_enable_flag =
3636 1 ; // Default to `on` in debug builds
3737#endif
3838
39- static void ASSERT_help () {
39+ static void ASSERT_help (llvm::raw_ostream &out ) {
4040 static int ASSERT_help_shown = 0 ;
4141 if (ASSERT_help_shown) {
4242 return ;
4343 }
4444 ASSERT_help_shown = 1 ;
4545
4646 if (!AssertHelp) {
47- llvm::errs () << " (to display assertion configuration options: -Xllvm -assert-help)\n " ;
47+ out << " (to display assertion configuration options: -Xllvm -assert-help)\n " ;
4848 return ;
4949 }
5050
51- llvm::errs () << " \n " ;
52- llvm::errs () << " Control assertion behavior with one or more of the following options:\n\n " ;
53- llvm::errs () << " -Xllvm -assert-continue\n " ;
54- llvm::errs () << " Continue after any failed assertion\n\n " ;
51+ out << " \n " ;
52+ out << " Control assertion behavior with one or more of the following options:\n\n " ;
53+ out << " -Xllvm -assert-continue\n " ;
54+ out << " Continue after any failed assertion\n\n " ;
5555}
5656
5757[[noreturn]]
@@ -68,21 +68,24 @@ void ASSERT_failure(const char *expr, const char *filename, int line, const char
6868 }
6969 }
7070
71- llvm::errs ()
72- << " Assertion failed: "
73- << " (" << expr << " ), "
74- << " function " << func << " at "
75- << filename << " :"
76- << line << " .\n " ;
71+ llvm::SmallString<0 > message;
72+ llvm::raw_svector_ostream out (message);
7773
78- ASSERT_help ();
74+ out << " Assertion failed: "
75+ << " (" << expr << " ), "
76+ << " function " << func << " at "
77+ << filename << " :"
78+ << line << " .\n " ;
79+
80+ ASSERT_help (out);
7981
8082 if (AssertContinue) {
83+ llvm::errs () << message;
8184 llvm::errs () << " Continuing after failed assertion (-Xllvm -assert-continue)\n " ;
8285 return ;
8386 }
8487
85- abort ( );
88+ _abortWithMessage (message );
8689}
8790
8891// This has to be callable in the same way as the macro version,
0 commit comments