[Lldb-commits] [PATCH] D10926: Remove unnecessary members from MICmdArgContext.

Bruce Mitchener bruce.mitchener at gmail.com
Fri Jul 3 07:03:25 PDT 2015


brucem created this revision.
brucem added reviewers: ki.stfu, abidh.
brucem added a subscriber: lldb-commits.

Remove unnecessary members from MICmdArgContext.

We don't need constants for these value stored in every instance
of the class.

http://reviews.llvm.org/D10926

Files:
  tools/lldb-mi/MICmdArgContext.cpp
  tools/lldb-mi/MICmdArgContext.h

Index: tools/lldb-mi/MICmdArgContext.h
===================================================================
--- tools/lldb-mi/MICmdArgContext.h
+++ tools/lldb-mi/MICmdArgContext.h
@@ -44,6 +44,4 @@
     // Attributes:
   private:
     CMIUtilString m_strCmdArgsAndOptions;
-    const char m_constCharSpace;
-    const CMIUtilString m_constStrSpace;
 };
Index: tools/lldb-mi/MICmdArgContext.cpp
===================================================================
--- tools/lldb-mi/MICmdArgContext.cpp
+++ tools/lldb-mi/MICmdArgContext.cpp
@@ -18,8 +18,6 @@
 // Throws:  None.
 //--
 CMICmdArgContext::CMICmdArgContext(void)
-    : m_constCharSpace(' ')
-    , m_constStrSpace(" ")
 {
 }
 
@@ -32,8 +30,6 @@
 //--
 CMICmdArgContext::CMICmdArgContext(const CMIUtilString &vrCmdLineArgsRaw)
     : m_strCmdArgsAndOptions(vrCmdLineArgsRaw)
-    , m_constCharSpace(' ')
-    , m_constStrSpace(" ")
 {
 }
 
@@ -104,7 +100,7 @@
         bool bPass1 = false;
         if (nPos != 0)
         {
-            if (m_strCmdArgsAndOptions[nPos - 1] == m_constCharSpace)
+            if (m_strCmdArgsAndOptions[nPos - 1] == ' ')
                 bPass1 = true;
         }
         else
@@ -117,7 +113,7 @@
             bool bPass2 = false;
             if (nEnd < nLenCntxt)
             {
-                if (m_strCmdArgsAndOptions[nEnd] == m_constCharSpace)
+                if (m_strCmdArgsAndOptions[nEnd] == ' ')
                 {
                     bPass2 = true;
                     nExtraSpace = 1;
@@ -170,7 +166,7 @@
             // Single words
             strBuildContextUp += rWord;
             if (bSpaceRequired)
-                strBuildContextUp += m_constStrSpace;
+                strBuildContextUp += " ";
         }
         else
         {
@@ -181,7 +177,7 @@
                 while (vArg != words)
                 {
                     if (bSpaceRequired)
-                        words += m_constStrSpace;
+                        words += " ";
                     words += *it;
                     if (++it == itEnd)
                         break;
@@ -213,7 +209,7 @@
 CMICmdArgContext::GetNumberArgsPresent(void) const
 {
     CMIUtilString::VecString_t vecOptions;
-    return m_strCmdArgsAndOptions.SplitConsiderQuotes(m_constStrSpace, vecOptions);
+    return m_strCmdArgsAndOptions.SplitConsiderQuotes(" ", vecOptions);
 }
 
 //++ ------------------------------------------------------------------------------------
@@ -227,7 +223,7 @@
 CMICmdArgContext::GetArgs(void) const
 {
     CMIUtilString::VecString_t vecOptions;
-    m_strCmdArgsAndOptions.SplitConsiderQuotes(m_constStrSpace, vecOptions);
+    m_strCmdArgsAndOptions.SplitConsiderQuotes(" ", vecOptions);
     return vecOptions;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10926.29018.patch
Type: text/x-patch
Size: 2721 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150703/a684548c/attachment.bin>


More information about the lldb-commits mailing list