Fix warnings detected by -Wpessimizing-move

patch by Eugene Zelenko

Differential Revision: http://reviews.llvm.org/D11429

llvm-svn: 243399
This commit is contained in:
Pavel Labath 2015-07-28 09:18:32 +00:00
parent e5b47640ee
commit 3a29f8b9ec
8 changed files with 20 additions and 23 deletions

View File

@ -189,7 +189,7 @@ SBPlatformShellCommand::~SBPlatformShellCommand()
void
SBPlatformShellCommand::Clear()
{
m_opaque_ptr->m_output = std::move(std::string());
m_opaque_ptr->m_output = std::string();
m_opaque_ptr->m_status = 0;
m_opaque_ptr->m_signo = 0;
}

View File

@ -1976,7 +1976,7 @@ ParseEntry (const llvm::StringRef &format_str,
switch (entry_def->type)
{
case FormatEntity::Entry::Type::ParentString:
entry.string = std::move(format_str.str());
entry.string = format_str.str();
return error; // Success
case FormatEntity::Entry::Type::ParentNumber:
@ -2026,7 +2026,7 @@ ParseEntry (const llvm::StringRef &format_str,
{
// Any value whose separator is a with a ':' means this value has a string argument
// that needs to be stored in the entry (like "${script.var:modulename.function}")
entry.string = std::move(value.str());
entry.string = value.str();
}
else
{
@ -2247,7 +2247,7 @@ FormatEntity::ParseInternal (llvm::StringRef &format, Entry &parent_entry, uint3
Entry entry;
if (!variable_format.empty())
{
entry.printf_format = std::move(variable_format.str());
entry.printf_format = variable_format.str();
// If the format contains a '%' we are going to assume this is
// a printf style format. So if you want to format your thread ID
@ -2449,7 +2449,7 @@ MakeMatch (const llvm::StringRef &prefix, const char *suffix)
{
std::string match(prefix.str());
match.append(suffix);
return std::move(match);
return match;
}
static void
@ -2463,7 +2463,7 @@ AddMatches (const FormatEntity::Entry::Definition *def,
{
for (size_t i=0; i<n; ++i)
{
std::string match = std::move(prefix.str());
std::string match = prefix.str();
if (match_prefix.empty())
matches.AppendString(MakeMatch (prefix, def->children[i].name));
else if (strncmp(def->children[i].name, match_prefix.data(), match_prefix.size()) == 0)
@ -2488,7 +2488,7 @@ FormatEntity::AutoComplete (const char *s,
// Hitting TAB after $ at the end of the string add a "{"
if (dollar_pos == str.size() - 1)
{
std::string match = std::move(str.str());
std::string match = str.str();
match.append("{");
matches.AppendString(std::move(match));
}
@ -2521,12 +2521,12 @@ FormatEntity::AutoComplete (const char *s,
if (n > 0)
{
// "${thread.info" <TAB>
matches.AppendString(std::move(MakeMatch (str, ".")));
matches.AppendString(MakeMatch(str, "."));
}
else
{
// "${thread.id" <TAB>
matches.AppendString(std::move(MakeMatch (str, "}")));
matches.AppendString(MakeMatch (str, "}"));
word_complete = true;
}
}

View File

@ -153,7 +153,7 @@ RegularExpression::Match::GetMatchAtIndex (const char* s, uint32_t idx, std::str
llvm::StringRef match_str_ref;
if (GetMatchAtIndex(s, idx, match_str_ref))
{
match_str = std::move(match_str_ref.str());
match_str = match_str_ref.str();
return true;
}
return false;
@ -258,4 +258,3 @@ RegularExpression::operator < (const RegularExpression& rhs) const
{
return (m_re < rhs.m_re);
}

View File

@ -36,7 +36,7 @@ StreamAsynchronousIO::Flush ()
if (!m_data.empty())
{
m_debugger.PrintAsync (m_data.data(), m_data.size(), m_for_stdout);
m_data = std::move(std::string());
m_data = std::string();
}
}

View File

@ -372,7 +372,7 @@ ClangExpressionParser::Parse (Stream &stream)
if (HostInfo::GetLLDBPath(lldb::ePathTypeLLDBTempSystemDir, tmpdir_file_spec))
{
tmpdir_file_spec.AppendPathComponent("lldb-%%%%%%.expr");
temp_source_path = std::move(tmpdir_file_spec.GetPath());
temp_source_path = tmpdir_file_spec.GetPath();
llvm::sys::fs::createUniqueFile(temp_source_path, temp_fd, result_path);
}
else

View File

@ -102,7 +102,7 @@ HostInfoBase::GetVendorString()
{
static std::once_flag g_once_flag;
std::call_once(g_once_flag, []() {
g_fields->m_vendor_string = std::move(HostInfo::GetArchitecture().GetTriple().getVendorName().str());
g_fields->m_vendor_string = HostInfo::GetArchitecture().GetTriple().getVendorName().str();
});
return g_fields->m_vendor_string;
}

View File

@ -592,7 +592,7 @@ ApplePropertyList::ExtractStringFromValueNode (const XMLNode &node, std::string
if (element_name == "true" || element_name == "false")
{
// The text value _is_ the element name itself...
value = std::move(element_name.str());
value = element_name.str();
return true;
}
else if (element_name == "dict" || element_name == "array")
@ -689,5 +689,3 @@ ApplePropertyList::GetStructuredData()
#endif
return root_sp;
}

View File

@ -2184,7 +2184,7 @@ ProcessGDBRemote::SetThreadStopInfo (StructuredData::Dictionary *thread_dict)
}
else if (key == g_key_name)
{
thread_name = std::move(object->GetStringValue());
thread_name = object->GetStringValue();
}
else if (key == g_key_qaddr)
{
@ -2193,7 +2193,7 @@ ProcessGDBRemote::SetThreadStopInfo (StructuredData::Dictionary *thread_dict)
else if (key == g_key_queue_name)
{
queue_vars_valid = true;
queue_name = std::move(object->GetStringValue());
queue_name = object->GetStringValue();
}
else if (key == g_key_queue_kind)
{
@ -2217,11 +2217,11 @@ ProcessGDBRemote::SetThreadStopInfo (StructuredData::Dictionary *thread_dict)
}
else if (key == g_key_reason)
{
reason = std::move(object->GetStringValue());
reason = object->GetStringValue();
}
else if (key == g_key_description)
{
description = std::move(object->GetStringValue());
description = object->GetStringValue();
}
else if (key == g_key_registers)
{
@ -2232,7 +2232,7 @@ ProcessGDBRemote::SetThreadStopInfo (StructuredData::Dictionary *thread_dict)
registers_dict->ForEach([&expedited_register_map](ConstString key, StructuredData::Object* object) -> bool {
const uint32_t reg = StringConvert::ToUInt32 (key.GetCString(), UINT32_MAX, 10);
if (reg != UINT32_MAX)
expedited_register_map[reg] = std::move(object->GetStringValue());
expedited_register_map[reg] = object->GetStringValue();
return true; // Keep iterating through all array items
});
}
@ -2468,7 +2468,7 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet)
if (mem_cache_addr != LLDB_INVALID_ADDRESS)
{
StringExtractor bytes;
bytes.GetStringRef() = std::move(pair.second.str());
bytes.GetStringRef() = pair.second.str();
const size_t byte_size = bytes.GetStringRef().size()/2;
DataBufferSP data_buffer_sp(new DataBufferHeap(byte_size, 0));
const size_t bytes_copied = bytes.GetHexBytes (data_buffer_sp->GetBytes(), byte_size, 0);