Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

kazutakahirata
Copy link
Contributor

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.

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.
@llvmbot
Copy link
Member

llvmbot commented May 31, 2025

@llvm/pr-subscribers-lldb

Author: Kazu Hirata (kazutakahirata)

Changes

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 --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));

@kazutakahirata kazutakahirata merged commit faea938 into llvm:main Jun 2, 2025
13 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250531_std_string_roundtrip_lldb branch June 2, 2025 06:24
DhruvSrivastavaX pushed a commit to DhruvSrivastavaX/lldb-for-aix that referenced this pull request Jun 12, 2025
…#142294)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants