diff options
author | Zachary Turner <zturner@google.com> | 2016-09-17 02:00:02 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-09-17 02:00:02 +0000 |
commit | 6fa7681bb613f4b92889b55a232507671e8f39be (patch) | |
tree | 2b67bb2fac624c5cda50d4156b9e461dafdac2f1 /lldb/source/Commands/CommandObjectBreakpoint.cpp | |
parent | 271106cbb9d1ed70d6e57b72612b6653ba20fb10 (diff) | |
download | llvm-6fa7681bb613f4b92889b55a232507671e8f39be.zip llvm-6fa7681bb613f4b92889b55a232507671e8f39be.tar.gz llvm-6fa7681bb613f4b92889b55a232507671e8f39be.tar.bz2 |
Convert many functions to use StringRefs.
Where possible, remove the const char* version. To keep the
risk and impact here minimal, I've only done the simplest
functions.
In the process, I found a few opportunities for adding some
unit tests, so I added those as well.
Tested on Windows, Linux, and OSX.
llvm-svn: 281799
Diffstat (limited to 'lldb/source/Commands/CommandObjectBreakpoint.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectBreakpoint.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index c5576e5..682e26b 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -92,6 +92,7 @@ public: ExecutionContext *execution_context) override { Error error; const int short_option = m_getopt_table[option_idx].val; + llvm::StringRef option_strref(option_arg ? option_arg : ""); switch (short_option) { case 'a': { @@ -245,10 +246,11 @@ public: m_func_name_type_mask |= eFunctionNameTypeAuto; break; - case 'N': - if (BreakpointID::StringIsBreakpointName(option_arg, error)) + case 'N': { + if (BreakpointID::StringIsBreakpointName(option_strref, error)) m_breakpoint_names.push_back(option_arg); break; + } case 'R': { lldb::addr_t tmp_offset_addr; @@ -1785,12 +1787,13 @@ public: ExecutionContext *execution_context) override { Error error; const int short_option = g_breakpoint_name_options[option_idx].short_option; + llvm::StringRef option_strref(option_value ? option_value : ""); switch (short_option) { case 'N': - if (BreakpointID::StringIsBreakpointName(option_value, error) && + if (BreakpointID::StringIsBreakpointName(option_strref, error) && error.Success()) - m_name.SetValueFromString(option_value); + m_name.SetValueFromString(option_strref); break; case 'B': |