[Lldb-commits] [lldb] [NFC][lldb][windows] refactor switch case braces (PR #197714)
via lldb-commits
lldb-commits at lists.llvm.org
Thu May 14 08:31:46 PDT 2026
================
@@ -564,49 +563,47 @@ NativeProcessWindows::OnDebugException(bool first_chance,
return ExceptionResult::BreakInDebugger;
}
- {
- // Any remaining STATUS_BREAKPOINT is a breakpoint instruction in the
- // program's own code (e.g. `__debugbreak()` or `__builtin_debugtrap()`).
- // Stop the debugger and let the user decide what to do.
- std::string desc =
- formatv("Exception {0:x8} encountered at address {1:x8}",
- record.GetExceptionCode(), record.GetExceptionAddress())
- .str();
- StopThread(record.GetThreadID(), StopReason::eStopReasonException,
- std::move(desc));
- SetState(eStateStopped, true);
- }
+ // Any remaining STATUS_BREAKPOINT is a breakpoint instruction in the
+ // program's own code (e.g. `__debugbreak()` or `__builtin_debugtrap()`).
+ // Stop the debugger and let the user decide what to do.
+ std::string desc =
+ formatv("Exception {0:x8} encountered at address {1:x8}",
+ record.GetExceptionCode(), record.GetExceptionAddress())
+ .str();
+ StopThread(record.GetThreadID(), StopReason::eStopReasonException,
+ std::move(desc));
+ SetState(eStateStopped, true);
return ExceptionResult::MaskException;
- default:
+ }
+ default: {
LLDB_LOG(log,
"Debugger thread reported exception {0:x} at address {1:x} "
"(first_chance={2})",
record.GetExceptionCode(), record.GetExceptionAddress(),
first_chance);
- {
- std::string desc;
- llvm::raw_string_ostream desc_stream(desc);
- desc_stream << "Exception "
- << llvm::format_hex(record.GetExceptionCode(), 8)
- << " encountered at address "
- << llvm::format_hex(record.GetExceptionAddress(), 8);
- StopThread(record.GetThreadID(), StopReason::eStopReasonException,
- desc.c_str());
-
- SetState(eStateStopped, true);
- }
+ std::string desc;
+ llvm::raw_string_ostream desc_stream(desc);
+ desc_stream << "Exception "
+ << llvm::format_hex(record.GetExceptionCode(), 8)
+ << " encountered at address "
+ << llvm::format_hex(record.GetExceptionAddress(), 8);
+ StopThread(record.GetThreadID(), StopReason::eStopReasonException,
+ desc.c_str());
+
+ SetState(eStateStopped, true);
// For non-breakpoints, give the application a chance to handle the
// exception first.
if (first_chance)
result = ExceptionResult::SendToApplication;
else
result = ExceptionResult::BreakInDebugger;
- }
- return result;
+ return result;
----------------
Nerixyz wrote:
`result` is only needed in this `default` branch. Its declaration could be moved inside.
https://github.com/llvm/llvm-project/pull/197714
More information about the lldb-commits
mailing list