From cac529dd495f05dcd24d33dd5fa595ff28eb7a60 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Sat, 10 Dec 2016 14:49:22 +0100 Subject: clang-tidy: apply performance-faster-string-find fixes --- Source/cmAddCustomTargetCommand.cxx | 2 +- Source/cmAddExecutableCommand.cxx | 2 +- Source/cmAddLibraryCommand.cxx | 2 +- Source/cmAuxSourceDirectoryCommand.cxx | 2 +- Source/cmFindPathCommand.cxx | 4 ++-- Source/cmStringCommand.cxx | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index 4e656aa..56f33b4 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -154,7 +154,7 @@ bool cmAddCustomTargetCommand::InitialPass( bool nameOk = cmGeneratorExpression::IsValidTargetName(targetName) && !cmGlobalGenerator::IsReservedTarget(targetName); if (nameOk) { - nameOk = targetName.find(":") == std::string::npos; + nameOk = targetName.find(':') == std::string::npos; } if (!nameOk) { cmake::MessageType messageType = cmake::AUTHOR_WARNING; diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx index 2a0bb15..aae1085 100644 --- a/Source/cmAddExecutableCommand.cxx +++ b/Source/cmAddExecutableCommand.cxx @@ -61,7 +61,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector const& args, !cmGlobalGenerator::IsReservedTarget(exename); if (nameOk && !importTarget && !isAlias) { - nameOk = exename.find(":") == std::string::npos; + nameOk = exename.find(':') == std::string::npos; } if (!nameOk) { cmake::MessageType messageType = cmake::AUTHOR_WARNING; diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index 5c9c744..9ae4ace 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -173,7 +173,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector const& args, !cmGlobalGenerator::IsReservedTarget(libName); if (nameOk && !importTarget && !isAlias) { - nameOk = libName.find(":") == std::string::npos; + nameOk = libName.find(':') == std::string::npos; } if (!nameOk) { cmake::MessageType messageType = cmake::AUTHOR_WARNING; diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index ecff0c3..7cfa4d8 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -49,7 +49,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass( for (size_t i = 0; i < numfiles; ++i) { std::string file = dir.GetFile(static_cast(i)); // Split the filename into base and extension - std::string::size_type dotpos = file.rfind("."); + std::string::size_type dotpos = file.rfind('.'); if (dotpos != std::string::npos) { std::string ext = file.substr(dotpos + 1); std::string base = file.substr(0, dotpos); diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index 0900f46..8d4bcf3 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -72,7 +72,7 @@ std::string cmFindPathCommand::FindHeaderInFramework(std::string const& file, { std::string fileName = file; std::string frameWorkName; - std::string::size_type pos = fileName.find("/"); + std::string::size_type pos = fileName.find('/'); // if there is a / in the name try to find the header as a framework // For example bar/foo.h would look for: // bar.framework/Headers/foo.h @@ -83,7 +83,7 @@ std::string cmFindPathCommand::FindHeaderInFramework(std::string const& file, frameWorkName = frameWorkName.substr(0, frameWorkName.size() - fileName.size() - 1); // if the framework has a path in it then just use the filename - if (frameWorkName.find("/") != frameWorkName.npos) { + if (frameWorkName.find('/') != frameWorkName.npos) { fileName = file; frameWorkName = ""; } diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 603c990..48c086f 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -342,7 +342,7 @@ bool cmStringCommand::RegexReplace(std::vector const& args) std::vector replacement; std::string::size_type l = 0; while (l < replace.length()) { - std::string::size_type r = replace.find("\\", l); + std::string::size_type r = replace.find('\\', l); if (r == std::string::npos) { r = replace.length(); replacement.push_back(replace.substr(l, r - l)); -- cgit v0.12