[Lldb-commits] [lldb] [lldb] Avoid creating a temporary instance of std::string (NFC) (PR #142294)

via lldb-commits lldb-commits at lists.llvm.org
Sat May 31 15:46:28 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

GetExceptionBreakpoint takes StringRef to look for a matching
breakpoint, so we don't need to create a temporary instance of
std::string on our own.


---
Full diff: https://github.com/llvm/llvm-project/pull/142294.diff


1 Files Affected:

- (modified) lldb/tools/lldb-dap/Handler/SetExceptionBreakpointsRequestHandler.cpp (+1-1) 


``````````diff
diff --git a/lldb/tools/lldb-dap/Handler/SetExceptionBreakpointsRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/SetExceptionBreakpointsRequestHandler.cpp
index 09d4fea2a9a22..2214833f8a770 100644
--- a/lldb/tools/lldb-dap/Handler/SetExceptionBreakpointsRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/SetExceptionBreakpointsRequestHandler.cpp
@@ -76,7 +76,7 @@ void SetExceptionBreakpointsRequestHandler::operator()(
 
   for (const auto &value : *filters) {
     const auto filter = GetAsString(value);
-    auto *exc_bp = dap.GetExceptionBreakpoint(std::string(filter));
+    auto *exc_bp = dap.GetExceptionBreakpoint(filter);
     if (exc_bp) {
       exc_bp->SetBreakpoint();
       unset_filters.erase(std::string(filter));

``````````

</details>


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


More information about the lldb-commits mailing list