Skip to content

Commit b74d671

Browse files
committed
Revert "[Basic] NFC: Remove ASSERT_help from header"
This reverts commit 9264125.
1 parent adc889c commit b74d671

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

include/swift/Basic/Assertions.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,4 +190,11 @@ extern int CONDITIONAL_ASSERT_Global_enable_flag;
190190
#define SWIFT_ASSERT_ONLY_DECL DEBUG_ASSERT_DECL
191191
#define SWIFT_ASSERT_ONLY DEBUG_ASSERT_EXPR
192192

193+
// ================================ Utility and Helper Functions ================================
194+
195+
// Utility function to print out help information for
196+
// various command-line options that affect the assertion
197+
// behavior.
198+
void ASSERT_help();
199+
193200
#endif // SWIFT_BASIC_ASSERTIONS_H

lib/Basic/Assertions.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,6 @@ int CONDITIONAL_ASSERT_Global_enable_flag =
3434
1; // Default to `on` in debug builds
3535
#endif
3636

37-
static void ASSERT_help() {
38-
static int ASSERT_help_shown = 0;
39-
if (ASSERT_help_shown) {
40-
return;
41-
}
42-
ASSERT_help_shown = 1;
43-
44-
if (!AssertHelp) {
45-
llvm::errs() << "(to display assertion configuration options: -Xllvm -assert-help)\n";
46-
return;
47-
}
48-
49-
llvm::errs() << "\n";
50-
llvm::errs() << "Control assertion behavior with one or more of the following options:\n\n";
51-
llvm::errs() << " -Xllvm -assert-continue\n";
52-
llvm::errs() << " Continue after any failed assertion\n\n";
53-
}
54-
5537
void ASSERT_failure(const char *expr, const char *filename, int line, const char *func) {
5638
// Find the last component of `filename`
5739
// Needed on Windows MSVC, which lacks __FILE_NAME__
@@ -80,6 +62,24 @@ void ASSERT_failure(const char *expr, const char *filename, int line, const char
8062
abort();
8163
}
8264

65+
void ASSERT_help() {
66+
static int ASSERT_help_shown = 0;
67+
if (ASSERT_help_shown) {
68+
return;
69+
}
70+
ASSERT_help_shown = 1;
71+
72+
if (!AssertHelp) {
73+
llvm::errs() << "(to display assertion configuration options: -Xllvm -assert-help)\n";
74+
return;
75+
}
76+
77+
llvm::errs() << "\n";
78+
llvm::errs() << "Control assertion behavior with one or more of the following options:\n\n";
79+
llvm::errs() << " -Xllvm -assert-continue\n";
80+
llvm::errs() << " Continue after any failed assertion\n\n";
81+
}
82+
8383
// This has to be callable in the same way as the macro version,
8484
// so we can't put it inside a namespace.
8585
#undef CONDITIONAL_ASSERT_enabled

0 commit comments

Comments
 (0)