Skip to content

Commit 4d10b95

Browse files
committed
[lldb] Fix formatting and whitespace in Debugger.{h,cpp} (NFC)
This file is heavily trafficked and the various formatting and whitespace issues make it tedious to work on.
1 parent df85259 commit 4d10b95

File tree

2 files changed

+36
-37
lines changed

2 files changed

+36
-37
lines changed

lldb/include/lldb/Core/Debugger.h

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -417,70 +417,69 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
417417
/// hand, use INTERRUPT_REQUESTED so this gets done consistently.
418418
///
419419
/// \param[in] formatv
420-
/// A formatv string for the interrupt message. If the elements of the
420+
/// A formatv string for the interrupt message. If the elements of the
421421
/// message are expensive to compute, you can use the no-argument form of
422-
/// InterruptRequested, then make up the report using REPORT_INTERRUPTION.
423-
///
422+
/// InterruptRequested, then make up the report using REPORT_INTERRUPTION.
423+
///
424424
/// \return
425425
/// A boolean value, if \b true an interruptible operation should interrupt
426426
/// itself.
427427
template <typename... Args>
428-
bool InterruptRequested(const char *cur_func,
429-
const char *formatv, Args &&... args) {
428+
bool InterruptRequested(const char *cur_func, const char *formatv,
429+
Args &&...args) {
430430
bool ret_val = InterruptRequested();
431431
if (ret_val) {
432432
if (!formatv)
433433
formatv = "Unknown message";
434434
if (!cur_func)
435435
cur_func = "<UNKNOWN>";
436-
ReportInterruption(InterruptionReport(cur_func,
437-
llvm::formatv(formatv,
438-
std::forward<Args>(args)...)));
436+
ReportInterruption(InterruptionReport(
437+
cur_func, llvm::formatv(formatv, std::forward<Args>(args)...)));
439438
}
440439
return ret_val;
441440
}
442-
443-
441+
444442
/// This handy define will keep you from having to generate a report for the
445443
/// interruption by hand. Use this except in the case where the arguments to
446444
/// the message description are expensive to compute.
447-
#define INTERRUPT_REQUESTED(debugger, ...) \
448-
(debugger).InterruptRequested(__func__, __VA_ARGS__)
445+
#define INTERRUPT_REQUESTED(debugger, ...) \
446+
(debugger).InterruptRequested(__func__, __VA_ARGS__)
449447

450448
// This form just queries for whether to interrupt, and does no reporting:
451449
bool InterruptRequested();
452-
450+
453451
// FIXME: Do we want to capture a backtrace at the interruption point?
454452
class InterruptionReport {
455453
public:
456-
InterruptionReport(std::string function_name, std::string description) :
457-
m_function_name(std::move(function_name)),
458-
m_description(std::move(description)),
459-
m_interrupt_time(std::chrono::system_clock::now()),
460-
m_thread_id(llvm::get_threadid()) {}
461-
462-
InterruptionReport(std::string function_name,
463-
const llvm::formatv_object_base &payload);
464-
465-
template <typename... Args>
466-
InterruptionReport(std::string function_name,
467-
const char *format, Args &&... args) :
468-
InterruptionReport(function_name, llvm::formatv(format, std::forward<Args>(args)...)) {}
454+
InterruptionReport(std::string function_name, std::string description)
455+
: m_function_name(std::move(function_name)),
456+
m_description(std::move(description)),
457+
m_interrupt_time(std::chrono::system_clock::now()),
458+
m_thread_id(llvm::get_threadid()) {}
459+
460+
InterruptionReport(std::string function_name,
461+
const llvm::formatv_object_base &payload);
462+
463+
template <typename... Args>
464+
InterruptionReport(std::string function_name, const char *format,
465+
Args &&...args)
466+
: InterruptionReport(
467+
function_name,
468+
llvm::formatv(format, std::forward<Args>(args)...)) {}
469469

470470
std::string m_function_name;
471471
std::string m_description;
472472
const std::chrono::time_point<std::chrono::system_clock> m_interrupt_time;
473473
const uint64_t m_thread_id;
474474
};
475475
void ReportInterruption(const InterruptionReport &report);
476-
#define REPORT_INTERRUPTION(debugger, ...) \
477-
(debugger).ReportInterruption(Debugger::InterruptionReport(__func__, \
478-
__VA_ARGS__))
476+
#define REPORT_INTERRUPTION(debugger, ...) \
477+
(debugger).ReportInterruption( \
478+
Debugger::InterruptionReport(__func__, __VA_ARGS__))
479479

480480
static DebuggerList DebuggersRequestingInterruption();
481481

482482
public:
483-
484483
// This is for use in the command interpreter, when you either want the
485484
// selected target, or if no target is present you want to prime the dummy
486485
// target with entities that will be copied over to new targets.

lldb/source/Core/Debugger.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ llvm::StringRef Debugger::GetAutosuggestionAnsiSuffix() const {
435435
}
436436

437437
bool Debugger::GetShowDontUsePoHint() const {
438-
const uint32_t idx = ePropertyShowDontUsePoHint;
438+
const uint32_t idx = ePropertyShowDontUsePoHint;
439439
return GetPropertyAtIndexAs<bool>(
440440
idx, g_debugger_properties[idx].default_uint_value != 0);
441441
}
@@ -1272,17 +1272,17 @@ bool Debugger::InterruptRequested() {
12721272
return GetCommandInterpreter().WasInterrupted();
12731273
}
12741274

1275-
Debugger::InterruptionReport::InterruptionReport(std::string function_name,
1276-
const llvm::formatv_object_base &payload) :
1277-
m_function_name(std::move(function_name)),
1278-
m_interrupt_time(std::chrono::system_clock::now()),
1279-
m_thread_id(llvm::get_threadid()) {
1275+
Debugger::InterruptionReport::InterruptionReport(
1276+
std::string function_name, const llvm::formatv_object_base &payload)
1277+
: m_function_name(std::move(function_name)),
1278+
m_interrupt_time(std::chrono::system_clock::now()),
1279+
m_thread_id(llvm::get_threadid()) {
12801280
llvm::raw_string_ostream desc(m_description);
12811281
desc << payload << "\n";
12821282
}
12831283

12841284
void Debugger::ReportInterruption(const InterruptionReport &report) {
1285-
// For now, just log the description:
1285+
// For now, just log the description:
12861286
Log *log = GetLog(LLDBLog::Host);
12871287
LLDB_LOG(log, "Interruption: {0}", report.m_description);
12881288
}

0 commit comments

Comments
 (0)