From 0d9a201e2624998922f825ebbe01aae0cce4bbd5 Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Fri, 13 Sep 2019 11:26:48 +0000 Subject: [lldb][NFC] Remove ArgEntry::ref member The StringRef should always be identical to the C string, so we might as well just create the StringRef from the C-string. This might be slightly slower until we implement the storage of ArgEntry with a string instead of a std::unique_ptr. Until then we have to do the additional strlen on the C string to construct the StringRef. llvm-svn: 371842 --- lldb/source/Commands/CommandObjectTarget.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lldb/source/Commands/CommandObjectTarget.cpp') diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index a7384a0a0d7..37e61ecf068 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -625,7 +625,7 @@ protected: for (auto &entry : args.entries()) { uint32_t target_idx; - if (entry.ref.getAsInteger(0, target_idx)) { + if (entry.ref().getAsInteger(0, target_idx)) { result.AppendErrorWithFormat("invalid target index '%s'\n", entry.c_str()); result.SetStatus(eReturnStatusFailed); @@ -2550,10 +2550,10 @@ protected: } } else { for (auto &entry : args.entries()) { - if (entry.ref.empty()) + if (entry.ref().empty()) continue; - FileSpec file_spec(entry.ref); + FileSpec file_spec(entry.ref()); if (FileSystem::Instance().Exists(file_spec)) { ModuleSpec module_spec(file_spec); if (m_uuid_option_group.GetOptionValue().OptionWasSet()) @@ -2583,10 +2583,10 @@ protected: } else { std::string resolved_path = file_spec.GetPath(); result.SetStatus(eReturnStatusFailed); - if (resolved_path != entry.ref) { + if (resolved_path != entry.ref()) { result.AppendErrorWithFormat( "invalid module path '%s' with resolved path '%s'\n", - entry.ref.str().c_str(), resolved_path.c_str()); + entry.ref().str().c_str(), resolved_path.c_str()); break; } result.AppendErrorWithFormat("invalid module path '%s'\n", @@ -4303,9 +4303,9 @@ protected: PlatformSP platform_sp(target->GetPlatform()); for (auto &entry : args.entries()) { - if (!entry.ref.empty()) { + if (!entry.ref().empty()) { auto &symbol_file_spec = module_spec.GetSymbolFileSpec(); - symbol_file_spec.SetFile(entry.ref, FileSpec::Style::native); + symbol_file_spec.SetFile(entry.ref(), FileSpec::Style::native); FileSystem::Instance().Resolve(symbol_file_spec); if (file_option_set) { module_spec.GetFileSpec() = @@ -4329,7 +4329,7 @@ protected: } else { std::string resolved_symfile_path = module_spec.GetSymbolFileSpec().GetPath(); - if (resolved_symfile_path != entry.ref) { + if (resolved_symfile_path != entry.ref()) { result.AppendErrorWithFormat( "invalid module path '%s' with resolved path '%s'\n", entry.c_str(), resolved_symfile_path.c_str()); -- cgit v1.2.3