[Lldb-commits] [lldb] r243399 - Fix warnings detected by -Wpessimizing-move

Pavel Labath labath at google.com
Tue Jul 28 02:18:32 PDT 2015


Author: labath
Date: Tue Jul 28 04:18:32 2015
New Revision: 243399

URL: http://llvm.org/viewvc/llvm-project?rev=243399&view=rev
Log:
Fix warnings detected by -Wpessimizing-move

patch by Eugene Zelenko

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

Modified:
    lldb/trunk/source/API/SBPlatform.cpp
    lldb/trunk/source/Core/FormatEntity.cpp
    lldb/trunk/source/Core/RegularExpression.cpp
    lldb/trunk/source/Core/StreamAsynchronousIO.cpp
    lldb/trunk/source/Expression/ClangExpressionParser.cpp
    lldb/trunk/source/Host/common/HostInfoBase.cpp
    lldb/trunk/source/Host/common/XML.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Modified: lldb/trunk/source/API/SBPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBPlatform.cpp?rev=243399&r1=243398&r2=243399&view=diff
==============================================================================
--- lldb/trunk/source/API/SBPlatform.cpp (original)
+++ lldb/trunk/source/API/SBPlatform.cpp Tue Jul 28 04:18:32 2015
@@ -189,7 +189,7 @@ SBPlatformShellCommand::~SBPlatformShell
 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;
 }

Modified: lldb/trunk/source/Core/FormatEntity.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatEntity.cpp?rev=243399&r1=243398&r2=243399&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatEntity.cpp (original)
+++ lldb/trunk/source/Core/FormatEntity.cpp Tue Jul 28 04:18:32 2015
@@ -1976,7 +1976,7 @@ ParseEntry (const llvm::StringRef &forma
             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 &forma
                 {
                     // 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::Strin
                         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
 {
     std::string match(prefix.str());
     match.append(suffix);
-    return std::move(match);
+    return match;
 }
 
 static void
@@ -2463,7 +2463,7 @@ AddMatches (const FormatEntity::Entry::D
     {
         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 *
         // 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 *
                                 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;
                                 }
                             }

Modified: lldb/trunk/source/Core/RegularExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/RegularExpression.cpp?rev=243399&r1=243398&r2=243399&view=diff
==============================================================================
--- lldb/trunk/source/Core/RegularExpression.cpp (original)
+++ lldb/trunk/source/Core/RegularExpression.cpp Tue Jul 28 04:18:32 2015
@@ -153,7 +153,7 @@ RegularExpression::Match::GetMatchAtInde
     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 Reg
 {
     return (m_re < rhs.m_re);
 }
-

Modified: lldb/trunk/source/Core/StreamAsynchronousIO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/StreamAsynchronousIO.cpp?rev=243399&r1=243398&r2=243399&view=diff
==============================================================================
--- lldb/trunk/source/Core/StreamAsynchronousIO.cpp (original)
+++ lldb/trunk/source/Core/StreamAsynchronousIO.cpp Tue Jul 28 04:18:32 2015
@@ -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();
     }
 }
 

Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=243399&r1=243398&r2=243399&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Tue Jul 28 04:18:32 2015
@@ -372,7 +372,7 @@ ClangExpressionParser::Parse (Stream &st
         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

Modified: lldb/trunk/source/Host/common/HostInfoBase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/HostInfoBase.cpp?rev=243399&r1=243398&r2=243399&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/HostInfoBase.cpp (original)
+++ lldb/trunk/source/Host/common/HostInfoBase.cpp Tue Jul 28 04:18:32 2015
@@ -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;
 }

Modified: lldb/trunk/source/Host/common/XML.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/XML.cpp?rev=243399&r1=243398&r2=243399&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/XML.cpp (original)
+++ lldb/trunk/source/Host/common/XML.cpp Tue Jul 28 04:18:32 2015
@@ -592,7 +592,7 @@ ApplePropertyList::ExtractStringFromValu
         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;
 }
-
-

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=243399&r1=243398&r2=243399&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Tue Jul 28 04:18:32 2015
@@ -2184,7 +2184,7 @@ ProcessGDBRemote::SetThreadStopInfo (Str
         }
         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 (Str
         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 (Str
         }
         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 (Str
                 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 (Str
                         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);





More information about the lldb-commits mailing list