Simplify find_first_of & find_last_of on single char.
Summary:
When calling find_first_of and find_last_of on a single character,
we can instead just call find / rfind and make our intent more
clear.
Reviewers: clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D12518
llvm-svn: 246609
diff --git a/lldb/tools/lldb-mi/MICmdArgValFile.cpp b/lldb/tools/lldb-mi/MICmdArgValFile.cpp
index 9e59dec..7f5b20e 100644
--- a/lldb/tools/lldb-mi/MICmdArgValFile.cpp
+++ b/lldb/tools/lldb-mi/MICmdArgValFile.cpp
@@ -142,8 +142,8 @@
if (vrFileNamePath.empty())
return false;
- const bool bHavePosSlash = (vrFileNamePath.find_first_of("/") != std::string::npos);
- const bool bHaveBckSlash = (vrFileNamePath.find_first_of("\\") != std::string::npos);
+ const bool bHavePosSlash = (vrFileNamePath.find('/') != std::string::npos);
+ const bool bHaveBckSlash = (vrFileNamePath.find('\\') != std::string::npos);
// Look for --someLongOption
size_t nPos = vrFileNamePath.find("--");
@@ -152,13 +152,13 @@
return false;
// Look for -f type short parameters
- nPos = vrFileNamePath.find_first_of("-");
+ nPos = vrFileNamePath.find('-');
const bool bShort = (nPos == 0);
if (bShort)
return false;
// Look for i1 i2 i3....
- nPos = vrFileNamePath.find_first_of("i");
+ nPos = vrFileNamePath.find('i');
const bool bFoundI1 = ((nPos == 0) && (::isdigit(vrFileNamePath[1])));
if (bFoundI1)
return false;