@@ -36,22 +36,22 @@ int CONDITIONAL_ASSERT_Global_enable_flag =
36
36
1 ; // Default to `on` in debug builds
37
37
#endif
38
38
39
- static void ASSERT_help () {
39
+ static void ASSERT_help (llvm::raw_ostream &out ) {
40
40
static int ASSERT_help_shown = 0 ;
41
41
if (ASSERT_help_shown) {
42
42
return ;
43
43
}
44
44
ASSERT_help_shown = 1 ;
45
45
46
46
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 " ;
48
48
return ;
49
49
}
50
50
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 " ;
55
55
}
56
56
57
57
[[noreturn]]
@@ -68,21 +68,24 @@ void ASSERT_failure(const char *expr, const char *filename, int line, const char
68
68
}
69
69
}
70
70
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);
77
73
78
- ASSERT_help ();
74
+ out << " Assertion failed: "
75
+ << " (" << expr << " ), "
76
+ << " function " << func << " at "
77
+ << filename << " :"
78
+ << line << " .\n " ;
79
+
80
+ ASSERT_help (out);
79
81
80
82
if (AssertContinue) {
83
+ llvm::errs () << message;
81
84
llvm::errs () << " Continuing after failed assertion (-Xllvm -assert-continue)\n " ;
82
85
return ;
83
86
}
84
87
85
- abort ( );
88
+ _abortWithMessage (message );
86
89
}
87
90
88
91
// This has to be callable in the same way as the macro version,
0 commit comments