@@ -33,7 +33,7 @@ using namespace llvm;
33
33
// If backtrace support is not enabled, compile out support for pretty stack
34
34
// traces. This has the secondary effect of not requiring thread local storage
35
35
// when backtrace support is disabled.
36
- #if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
36
+ #if ENABLE_BACKTRACES
37
37
38
38
// We need a thread local pointer to manage the stack of our stack trace
39
39
// objects, but we *really* cannot tolerate destructors running and do not want
@@ -127,19 +127,18 @@ static void CrashHandler(void *) {
127
127
#endif
128
128
}
129
129
130
- // defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
131
- #endif
130
+ #endif // ENABLE_BACKTRACES
132
131
133
132
PrettyStackTraceEntry::PrettyStackTraceEntry () {
134
- #if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
133
+ #if ENABLE_BACKTRACES
135
134
// Link ourselves.
136
135
NextEntry = PrettyStackTraceHead;
137
136
PrettyStackTraceHead = this ;
138
137
#endif
139
138
}
140
139
141
140
PrettyStackTraceEntry::~PrettyStackTraceEntry () {
142
- #if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
141
+ #if ENABLE_BACKTRACES
143
142
assert (PrettyStackTraceHead == this &&
144
143
" Pretty stack trace entry destruction is out of order" );
145
144
PrettyStackTraceHead = NextEntry;
@@ -174,31 +173,31 @@ void PrettyStackTraceProgram::print(raw_ostream &OS) const {
174
173
OS << ' \n ' ;
175
174
}
176
175
177
- #if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
176
+ #if ENABLE_BACKTRACES
178
177
static bool RegisterCrashPrinter () {
179
178
sys::AddSignalHandler (CrashHandler, nullptr );
180
179
return false ;
181
180
}
182
181
#endif
183
182
184
183
void llvm::EnablePrettyStackTrace () {
185
- #if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
184
+ #if ENABLE_BACKTRACES
186
185
// The first time this is called, we register the crash printer.
187
186
static bool HandlerRegistered = RegisterCrashPrinter ();
188
187
(void )HandlerRegistered;
189
188
#endif
190
189
}
191
190
192
191
const void *llvm::SavePrettyStackState () {
193
- #if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
192
+ #if ENABLE_BACKTRACES
194
193
return PrettyStackTraceHead;
195
194
#else
196
195
return nullptr ;
197
196
#endif
198
197
}
199
198
200
199
void llvm::RestorePrettyStackState (const void *Top) {
201
- #if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
200
+ #if ENABLE_BACKTRACES
202
201
PrettyStackTraceHead =
203
202
static_cast <PrettyStackTraceEntry *>(const_cast <void *>(Top));
204
203
#endif
0 commit comments