diff options
author | Zachary Turner <zturner@google.com> | 2016-11-17 18:08:12 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-11-17 18:08:12 +0000 |
commit | 31d97a5c8ab78c619deada0cdb1fcf64021d25dd (patch) | |
tree | a1f642a22b8975a80013c7ab8bc98a7ea763346e /lldb/source/Commands | |
parent | ff0382c16190cd2b1bc47b27c5db0570b90f1d39 (diff) | |
download | bcm5719-llvm-31d97a5c8ab78c619deada0cdb1fcf64021d25dd.tar.gz bcm5719-llvm-31d97a5c8ab78c619deada0cdb1fcf64021d25dd.zip |
Rewrite all Property related functions in terms of StringRef.
This was a bit tricky, especially for things like
OptionValueArray and OptionValueDictionary since they do some
funky string parsing. Rather than try to re-write line-by-line
I tried to make the StringRef usage idiomatic, even though
it meant often re-writing from scratch large blocks of code
in a different way while keeping true to the original intent.
The finished code is a big improvement though, and often much
shorter than the original code. All tests and unit tests
pass on Windows and Linux.
llvm-svn: 287242
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r-- | lldb/source/Commands/CommandObjectMemory.cpp | 3 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectProcess.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectSettings.cpp | 2 |
3 files changed, 5 insertions, 6 deletions
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index e49f49f2621..727a7fa6bbe 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -1062,8 +1062,7 @@ protected: DataBufferHeap buffer; if (m_memory_options.m_string.OptionWasSet()) - buffer.CopyData(m_memory_options.m_string.GetStringValue(), - strlen(m_memory_options.m_string.GetStringValue())); + buffer.CopyData(m_memory_options.m_string.GetStringValue()); else if (m_memory_options.m_expr.OptionWasSet()) { StackFrame *frame = m_exe_ctx.GetFramePtr(); ValueObjectSP result_sp; diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index dea996c0ff9..144ba3f1c48 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -175,7 +175,7 @@ protected: if (!StopProcessIfNecessary(m_exe_ctx.GetProcessPtr(), state, result)) return false; - const char *target_settings_argv0 = target->GetArg0(); + llvm::StringRef target_settings_argv0 = target->GetArg0(); // Determine whether we will disable ASLR or leave it in the default state // (i.e. enabled if the platform supports it). @@ -210,9 +210,9 @@ protected: m_options.launch_info.GetEnvironmentEntries().AppendArguments( environment); - if (target_settings_argv0) { + if (!target_settings_argv0.empty()) { m_options.launch_info.GetArguments().AppendArgument( - llvm::StringRef(target_settings_argv0)); + target_settings_argv0); m_options.launch_info.SetExecutableFile( exe_module_sp->GetPlatformFileSpec(), false); } else { diff --git a/lldb/source/Commands/CommandObjectSettings.cpp b/lldb/source/Commands/CommandObjectSettings.cpp index 54efead2070..0a97804fbf6 100644 --- a/lldb/source/Commands/CommandObjectSettings.cpp +++ b/lldb/source/Commands/CommandObjectSettings.cpp @@ -1011,7 +1011,7 @@ protected: } Error error(m_interpreter.GetDebugger().SetPropertyValue( - &m_exe_ctx, eVarSetOperationClear, var_name, nullptr)); + &m_exe_ctx, eVarSetOperationClear, var_name, llvm::StringRef())); if (error.Fail()) { result.AppendError(error.AsCString()); result.SetStatus(eReturnStatusFailed); |