[Lldb-commits] [lldb] [lldb][lldb-dap] Cleanup breakpoint filters. (PR #87550)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri May 24 12:38:38 PDT 2024


================
@@ -61,40 +61,37 @@ DAP::DAP()
 DAP::~DAP() = default;
 
 void DAP::PopulateExceptionBreakpoints() {
+  exception_breakpoints = {};
   if (debugger.SupportsLanguage(lldb::eLanguageTypeC_plus_plus)) {
-    exception_breakpoints.emplace_back(
+    exception_breakpoints->emplace_back(
         {"cpp_catch", "C++ Catch", lldb::eLanguageTypeC_plus_plus});
-    exception_breakpoints.emplace_back(
+    exception_breakpoints->emplace_back(
         {"cpp_throw", "C++ Throw", lldb::eLanguageTypeC_plus_plus});
   }
   if (debugger.SupportsLanguage(lldb::eLanguageTypeObjC)) {
-    exception_breakpoints.emplace_back(
+    exception_breakpoints->emplace_back(
         {"objc_catch", "Objective-C Catch", lldb::eLanguageTypeObjC});
-    exception_breakpoints.emplace_back(
+    exception_breakpoints->emplace_back(
         {"objc_throw", "Objective-C Throw", lldb::eLanguageTypeObjC});
   }
   if (debugger.SupportsLanguage(lldb::eLanguageTypeSwift)) {
-    exception_breakpoints.emplace_back(
+    exception_breakpoints->emplace_back(
         {"swift_catch", "Swift Catch", lldb::eLanguageTypeSwift});
-    exception_breakpoints.emplace_back(
+    exception_breakpoints->emplace_back(
         {"swift_throw", "Swift Throw", lldb::eLanguageTypeSwift});
   }
-
-  bp_initted = true;
 }
 
 ExceptionBreakpoint *DAP::GetExceptionBreakpoint(const std::string &filter) {
-  assert(bp_initted);
-  for (auto &bp : exception_breakpoints) {
+  for (auto &bp : *exception_breakpoints) {
----------------
JDevlieghere wrote:

You could keep the assert:

```
assert(exception_breakpoints.has_value() && "PopulateExceptionBreakpoints must be called first") 
```

https://github.com/llvm/llvm-project/pull/87550


More information about the lldb-commits mailing list