[Lldb-commits] [lldb] r241390 - Use string::find(char) for single character strings.
Bruce Mitchener
bruce.mitchener at gmail.com
Fri Jul 3 22:16:58 PDT 2015
Author: brucem
Date: Sat Jul 4 00:16:58 2015
New Revision: 241390
URL: http://llvm.org/viewvc/llvm-project?rev=241390&view=rev
Log:
Use string::find(char) for single character strings.
Summary: Use string::find(char) for single character strings.
Reviewers: abidh, ki.stfu, clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D10943
Modified:
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/tools/lldb-mi/MICmdArgValOptionShort.cpp
lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp
lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp
lldb/trunk/tools/lldb-mi/MICmdFactory.cpp
lldb/trunk/tools/lldb-mi/MICmdInterpreter.cpp
Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=241390&r1=241389&r2=241390&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Sat Jul 4 00:16:58 2015
@@ -1558,7 +1558,7 @@ ObjectFileELF::GetSegmentDataByIndex(lld
std::string
ObjectFileELF::StripLinkerSymbolAnnotations(llvm::StringRef symbol_name) const
{
- size_t pos = symbol_name.find("@");
+ size_t pos = symbol_name.find('@');
return symbol_name.substr(0, pos).str();
}
Modified: lldb/trunk/tools/lldb-mi/MICmdArgValOptionShort.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdArgValOptionShort.cpp?rev=241390&r1=241389&r2=241390&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdArgValOptionShort.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdArgValOptionShort.cpp Sat Jul 4 00:16:58 2015
@@ -80,7 +80,7 @@ CMICmdArgValOptionShort::IsArgShortOptio
return false;
// Look for -f short option
- nPos = vrTxt.find("-");
+ nPos = vrTxt.find('-');
if (nPos != 0)
return false;
Modified: lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp?rev=241390&r1=241389&r2=241390&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp Sat Jul 4 00:16:58 2015
@@ -231,11 +231,11 @@ CMICmdArgValString::IsStringArgSingleTex
return false;
// Look for -f type short options, if found reject
- if ((0 == vrTxt.find("-")) && (vrTxt.length() == 2))
+ if ((0 == vrTxt.find('-')) && (vrTxt.length() == 2))
return false;
// Look for thread group i1 i2 i3...., if found reject
- if ((vrTxt.find("i") == 0) && ::isdigit(vrTxt[1]))
+ if ((vrTxt.find('i') == 0) && ::isdigit(vrTxt[1]))
return false;
// Look for numbers, if found reject
Modified: lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp?rev=241390&r1=241389&r2=241390&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp Sat Jul 4 00:16:58 2015
@@ -1750,8 +1750,8 @@ CMICmdCmdDataInfoLine::Acknowledge(void)
// LineEntry: \[0x0000000100000f37-0x0000000100000f45\): /path/to/file:3[:1]
// ^^^^^^^^^^^^^^^^^^ -- start address
- const size_t nStartAddressStartPos = rLine.find("[");
- const size_t nStartAddressEndPos = rLine.find("-");
+ const size_t nStartAddressStartPos = rLine.find('[');
+ const size_t nStartAddressEndPos = rLine.find('-');
const size_t nStartAddressLen = nStartAddressEndPos - nStartAddressStartPos - 1;
const CMIUtilString strStartAddress(rLine.substr(nStartAddressStartPos + 1, nStartAddressLen).c_str());
const CMICmnMIValueConst miValueConst(strStartAddress);
@@ -1760,7 +1760,7 @@ CMICmdCmdDataInfoLine::Acknowledge(void)
// LineEntry: \[0x0000000100000f37-0x0000000100000f45\): /path/to/file:3[:1]
// ^^^^^^^^^^^^^^^^^^ -- end address
- const size_t nEndAddressEndPos = rLine.find(")");
+ const size_t nEndAddressEndPos = rLine.find(')');
const size_t nEndAddressLen = nEndAddressEndPos - nStartAddressEndPos - 1;
const CMIUtilString strEndAddress(rLine.substr(nStartAddressEndPos + 1, nEndAddressLen).c_str());
const CMICmnMIValueConst miValueConst2(strEndAddress);
Modified: lldb/trunk/tools/lldb-mi/MICmdFactory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdFactory.cpp?rev=241390&r1=241389&r2=241390&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdFactory.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdFactory.cpp Sat Jul 4 00:16:58 2015
@@ -159,7 +159,7 @@ CMICmdFactory::IsValid(const CMIUtilStri
return false;
}
- const size_t nPos = vMiCmd.find(" ");
+ const size_t nPos = vMiCmd.find(' ');
if (nPos != std::string::npos)
bValid = false;
Modified: lldb/trunk/tools/lldb-mi/MICmdInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdInterpreter.cpp?rev=241390&r1=241389&r2=241390&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdInterpreter.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdInterpreter.cpp Sat Jul 4 00:16:58 2015
@@ -153,7 +153,7 @@ bool
CMICmdInterpreter::MiHasCmdTokenEndingHyphen(const CMIUtilString &vTextLine)
{
// The hyphen is mandatory
- const size_t nPos = vTextLine.find("-", 0);
+ const size_t nPos = vTextLine.find('-', 0);
if ((nPos == std::string::npos))
return false;
@@ -215,7 +215,7 @@ CMICmdInterpreter::MiHasCmdTokenEndingAl
bool
CMICmdInterpreter::MiHasCmdTokenPresent(const CMIUtilString &vTextLine)
{
- const size_t nPos = vTextLine.find("-", 0);
+ const size_t nPos = vTextLine.find('-', 0);
return (nPos > 0);
}
@@ -246,12 +246,12 @@ CMICmdInterpreter::MiHasCmd(const CMIUti
}
else
{
- nPos = vTextLine.find("-", 0);
+ nPos = vTextLine.find('-', 0);
}
bool bFoundCmd = false;
const size_t nLen = vTextLine.length();
- const size_t nPos2 = vTextLine.find(" ", nPos);
+ const size_t nPos2 = vTextLine.find(' ', nPos);
if (nPos2 != std::string::npos)
{
if (nPos2 == nLen)
More information about the lldb-commits
mailing list