[llvm] r288235 - Apply clang-tidy's 'performance-faster-string-find' check to LLVM.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 30 02:01:12 PST 2016
Author: d0k
Date: Wed Nov 30 04:01:11 2016
New Revision: 288235
URL: http://llvm.org/viewvc/llvm-project?rev=288235&view=rev
Log:
Apply clang-tidy's 'performance-faster-string-find' check to LLVM.
No functionality change intended.
Modified:
llvm/trunk/lib/Support/SpecialCaseList.cpp
llvm/trunk/tools/gold/gold-plugin.cpp
llvm/trunk/tools/llvm-cov/CodeCoverage.cpp
llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
llvm/trunk/utils/TableGen/CodeGenInstruction.cpp
Modified: llvm/trunk/lib/Support/SpecialCaseList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SpecialCaseList.cpp?rev=288235&r1=288234&r2=288235&view=diff
==============================================================================
--- llvm/trunk/lib/Support/SpecialCaseList.cpp (original)
+++ llvm/trunk/lib/Support/SpecialCaseList.cpp Wed Nov 30 04:01:11 2016
@@ -110,7 +110,7 @@ bool SpecialCaseList::parse(const Memory
}
// Replace * with .*
- for (size_t pos = 0; (pos = Regexp.find("*", pos)) != std::string::npos;
+ for (size_t pos = 0; (pos = Regexp.find('*', pos)) != std::string::npos;
pos += strlen(".*")) {
Regexp.replace(pos, strlen("*"), ".*");
}
Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=288235&r1=288234&r2=288235&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Wed Nov 30 04:01:11 2016
@@ -203,7 +203,7 @@ namespace options {
thinlto_emit_imports_files = true;
} else if (opt.startswith("thinlto-prefix-replace=")) {
thinlto_prefix_replace = opt.substr(strlen("thinlto-prefix-replace="));
- if (thinlto_prefix_replace.find(";") == std::string::npos)
+ if (thinlto_prefix_replace.find(';') == std::string::npos)
message(LDPL_FATAL, "thinlto-prefix-replace expects 'old;new' format");
} else if (opt.startswith("cache-dir=")) {
cache_dir = opt.substr(strlen("cache-dir="));
Modified: llvm/trunk/tools/llvm-cov/CodeCoverage.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CodeCoverage.cpp?rev=288235&r1=288234&r2=288235&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CodeCoverage.cpp (original)
+++ llvm/trunk/tools/llvm-cov/CodeCoverage.cpp Wed Nov 30 04:01:11 2016
@@ -742,7 +742,7 @@ int CodeCoverageTool::show(int argc, con
auto ModifiedTime = Status.getLastModificationTime();
std::string ModifiedTimeStr = to_string(ModifiedTime);
- size_t found = ModifiedTimeStr.rfind(":");
+ size_t found = ModifiedTimeStr.rfind(':');
ViewOpts.CreatedTimeStr = (found != std::string::npos)
? "Created: " + ModifiedTimeStr.substr(0, found)
: "Created: " + ModifiedTimeStr;
Modified: llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp?rev=288235&r1=288234&r2=288235&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp (original)
+++ llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp Wed Nov 30 04:01:11 2016
@@ -606,7 +606,7 @@ static void remapSectionsAndSymbols(cons
// Add dummy symbols to the memory manager.
for (const auto &Mapping : DummySymbolMappings) {
- size_t EqualsIdx = Mapping.find_first_of("=");
+ size_t EqualsIdx = Mapping.find_first_of('=');
if (EqualsIdx == StringRef::npos)
report_fatal_error("Invalid dummy symbol specification '" + Mapping +
Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenInstruction.cpp?rev=288235&r1=288234&r2=288235&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenInstruction.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenInstruction.cpp Wed Nov 30 04:01:11 2016
@@ -165,7 +165,7 @@ CGIOperandList::ParseOperandName(const s
std::string SubOpName;
// Check to see if this is $foo.bar.
- std::string::size_type DotIdx = OpName.find_first_of(".");
+ std::string::size_type DotIdx = OpName.find_first_of('.');
if (DotIdx != std::string::npos) {
SubOpName = OpName.substr(DotIdx+1);
if (SubOpName.empty())
More information about the llvm-commits
mailing list