[Lldb-commits] [lldb] [lldb][NFCI] BreakpointResolverName ctor shouldn't unnecessarily copy data (PR #66001)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Sep 11 12:53:47 PDT 2023
https://github.com/bulbazord created https://github.com/llvm/llvm-project/pull/66001:
Instead of creating a copy of the vector, we should just pass a reference along. The only method that calls this Ctor also holds onto a non-mutable reference to the vector of strings, so this should just make sense.
>From 8a2298fd612c10ac409256b675e02fc2912acac7 Mon Sep 17 00:00:00 2001
From: Alex Langford <alangford at apple.com>
Date: Mon, 11 Sep 2023 11:40:50 -0700
Subject: [PATCH] [lldb][NFCI] BreakpointResolverName ctor shouldn't
unnecessarily copy data
Instead of creating a copy of the vector, we should just pass a
reference along. The only method that calls this Ctor also holds onto a
non-mutable reference to the vector of strings, so this should just make
sense.
---
lldb/include/lldb/Breakpoint/BreakpointResolverName.h | 2 +-
lldb/source/Breakpoint/BreakpointResolverName.cpp | 10 ++++------
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/lldb/include/lldb/Breakpoint/BreakpointResolverName.h b/lldb/include/lldb/Breakpoint/BreakpointResolverName.h
index 7a9fc466076799a..cbfcbc9af0ea1cb 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointResolverName.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointResolverName.h
@@ -38,7 +38,7 @@ class BreakpointResolverName : public BreakpointResolver {
// This one takes a C++ array of names. It is always MatchType = Exact.
BreakpointResolverName(const lldb::BreakpointSP &bkpt,
- std::vector<std::string> names,
+ const std::vector<std::string> &names,
lldb::FunctionNameType name_type_mask,
lldb::LanguageType language, lldb::addr_t offset,
bool skip_prologue);
diff --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp b/lldb/source/Breakpoint/BreakpointResolverName.cpp
index b533bdfb9c11ce5..861377a5ddabfb5 100644
--- a/lldb/source/Breakpoint/BreakpointResolverName.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp
@@ -56,12 +56,10 @@ BreakpointResolverName::BreakpointResolverName(
}
}
-BreakpointResolverName::BreakpointResolverName(const BreakpointSP &bkpt,
- std::vector<std::string> names,
- FunctionNameType name_type_mask,
- LanguageType language,
- lldb::addr_t offset,
- bool skip_prologue)
+BreakpointResolverName::BreakpointResolverName(
+ const BreakpointSP &bkpt, const std::vector<std::string> &names,
+ FunctionNameType name_type_mask, LanguageType language, lldb::addr_t offset,
+ bool skip_prologue)
: BreakpointResolver(bkpt, BreakpointResolver::NameResolver, offset),
m_match_type(Breakpoint::Exact), m_language(language),
m_skip_prologue(skip_prologue) {
More information about the lldb-commits
mailing list