fixed and enabled `performance-faster-string-find` clang-tidy warning (#4769)
This commit is contained in:
parent
14e78e1800
commit
8ef14dad98
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
Checks: '*,-abseil-*,-altera-*,-android-*,-boost-*,-cert-*,-cppcoreguidelines-*,-darwin-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,google-explicit-constructor,-readability-braces-around-statements,-readability-magic-numbers,-bugprone-macro-parentheses,-readability-isolate-declaration,-readability-function-size,-modernize-use-trailing-return-type,-readability-implicit-bool-conversion,-readability-uppercase-literal-suffix,-modernize-use-auto,-readability-else-after-return,-modernize-use-default-member-init,-readability-redundant-member-init,-performance-faster-string-find,-modernize-avoid-c-arrays,-modernize-use-equals-default,-readability-container-size-empty,-readability-simplify-boolean-expr,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-readability-const-return-type,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-misc-non-private-member-variables-in-classes,-clang-analyzer-*,-bugprone-signed-char-misuse,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-readability-function-cognitive-complexity,-readability-redundant-access-specifiers,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument,-readability-identifier-length,-readability-container-data-pointer,-bugprone-assignment-in-if-condition,-misc-const-correctness,-portability-std-allocator-const,-modernize-deprecated-ios-base-aliases,-bugprone-unchecked-optional-access,-modernize-replace-auto-ptr,-readability-identifier-naming,-portability-simd-intrinsics'
|
||||
Checks: '*,-abseil-*,-altera-*,-android-*,-boost-*,-cert-*,-cppcoreguidelines-*,-darwin-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,google-explicit-constructor,-readability-braces-around-statements,-readability-magic-numbers,-bugprone-macro-parentheses,-readability-isolate-declaration,-readability-function-size,-modernize-use-trailing-return-type,-readability-implicit-bool-conversion,-readability-uppercase-literal-suffix,-modernize-use-auto,-readability-else-after-return,-modernize-use-default-member-init,-readability-redundant-member-init,-modernize-avoid-c-arrays,-modernize-use-equals-default,-readability-container-size-empty,-readability-simplify-boolean-expr,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-readability-const-return-type,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-misc-non-private-member-variables-in-classes,-clang-analyzer-*,-bugprone-signed-char-misuse,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-readability-function-cognitive-complexity,-readability-redundant-access-specifiers,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument,-readability-identifier-length,-readability-container-data-pointer,-bugprone-assignment-in-if-condition,-misc-const-correctness,-portability-std-allocator-const,-modernize-deprecated-ios-base-aliases,-bugprone-unchecked-optional-access,-modernize-replace-auto-ptr,-readability-identifier-naming,-portability-simd-intrinsics'
|
||||
WarningsAsErrors: '*'
|
||||
HeaderFilterRegex: '(cli|gui|lib|oss-fuzz|test|triage)\/[a-z]+\.h'
|
||||
CheckOptions:
|
||||
|
|
|
@ -58,7 +58,6 @@ These do not (always) increase readability.
|
|||
|
||||
To be documented.
|
||||
|
||||
`performance-faster-string-find`<br>
|
||||
`bugprone-narrowing-conversions`<br>
|
||||
`performance-no-automatic-move`<br>
|
||||
|
||||
|
|
|
@ -581,7 +581,7 @@ bool CppCheckExecutor::executeCommand(std::string exe, std::vector<std::string>
|
|||
for (const std::string &arg : args) {
|
||||
if (!joinedArgs.empty())
|
||||
joinedArgs += " ";
|
||||
if (arg.find(" ") != std::string::npos)
|
||||
if (arg.find(' ') != std::string::npos)
|
||||
joinedArgs += '"' + arg + '"';
|
||||
else
|
||||
joinedArgs += arg;
|
||||
|
|
|
@ -739,7 +739,7 @@ void ProjectFileDialog::addSingleSuppression(const Suppressions::Suppression &su
|
|||
bool found_relative = false;
|
||||
|
||||
// Replace relative file path in the suppression with the absolute one
|
||||
if ((suppression.fileName.find("*") == std::string::npos) &&
|
||||
if ((suppression.fileName.find('*') == std::string::npos) &&
|
||||
(suppression.fileName.find(sep) == std::string::npos)) {
|
||||
QFileInfo inf(mProjectFile->getFilename());
|
||||
QString rootpath = inf.absolutePath();
|
||||
|
|
|
@ -1447,7 +1447,7 @@ void CheckUnusedVar::checkStructMemberUsage()
|
|||
continue;
|
||||
|
||||
// Bail out for template struct, members might be used in non-matching instantiations
|
||||
if (scope.className.find("<") != std::string::npos)
|
||||
if (scope.className.find('<') != std::string::npos)
|
||||
continue;
|
||||
|
||||
// bail out if struct is inherited
|
||||
|
|
|
@ -124,22 +124,22 @@ static std::string unquote(const std::string &s)
|
|||
static std::vector<std::string> splitString(const std::string &line)
|
||||
{
|
||||
std::vector<std::string> ret;
|
||||
std::string::size_type pos1 = line.find_first_not_of(" ");
|
||||
std::string::size_type pos1 = line.find_first_not_of(' ');
|
||||
while (pos1 < line.size()) {
|
||||
std::string::size_type pos2;
|
||||
if (std::strchr("*()", line[pos1])) {
|
||||
ret.push_back(line.substr(pos1,1));
|
||||
pos1 = line.find_first_not_of(" ", pos1 + 1);
|
||||
pos1 = line.find_first_not_of(' ', pos1 + 1);
|
||||
continue;
|
||||
}
|
||||
if (line[pos1] == '<')
|
||||
pos2 = line.find(">", pos1);
|
||||
pos2 = line.find('>', pos1);
|
||||
else if (line[pos1] == '\"')
|
||||
pos2 = line.find("\"", pos1+1);
|
||||
pos2 = line.find('\"', pos1+1);
|
||||
else if (line[pos1] == '\'') {
|
||||
pos2 = line.find("\'", pos1+1);
|
||||
pos2 = line.find('\'', pos1+1);
|
||||
if (pos2 < (int)line.size() - 3 && line.compare(pos2, 3, "\':\'", 0, 3) == 0)
|
||||
pos2 = line.find("\'", pos2 + 3);
|
||||
pos2 = line.find('\'', pos2 + 3);
|
||||
} else {
|
||||
pos2 = pos1;
|
||||
while (pos2 < line.size() && (line[pos2] == '_' || line[pos2] == ':' || std::isalnum((unsigned char)line[pos2])))
|
||||
|
@ -159,10 +159,10 @@ static std::vector<std::string> splitString(const std::string &line)
|
|||
}
|
||||
}
|
||||
|
||||
pos2 = line.find(" ", pos1) - 1;
|
||||
pos2 = line.find(' ', pos1) - 1;
|
||||
if ((std::isalpha(line[pos1]) || line[pos1] == '_') &&
|
||||
line.find("::", pos1) < pos2 &&
|
||||
line.find("::", pos1) < line.find("<", pos1)) {
|
||||
line.find("::", pos1) < line.find('<', pos1)) {
|
||||
pos2 = line.find("::", pos1);
|
||||
ret.push_back(line.substr(pos1, pos2-pos1));
|
||||
ret.emplace_back("::");
|
||||
|
@ -170,10 +170,10 @@ static std::vector<std::string> splitString(const std::string &line)
|
|||
continue;
|
||||
}
|
||||
if ((std::isalpha(line[pos1]) || line[pos1] == '_') &&
|
||||
line.find("<", pos1) < pos2 &&
|
||||
line.find("<<",pos1) != line.find("<",pos1) &&
|
||||
line.find(">", pos1) != std::string::npos &&
|
||||
line.find(">", pos1) > pos2) {
|
||||
line.find('<', pos1) < pos2 &&
|
||||
line.find("<<",pos1) != line.find('<',pos1) &&
|
||||
line.find('>', pos1) != std::string::npos &&
|
||||
line.find('>', pos1) > pos2) {
|
||||
int level = 0;
|
||||
for (pos2 = pos1; pos2 < line.size(); ++pos2) {
|
||||
if (line[pos2] == '<')
|
||||
|
@ -186,7 +186,7 @@ static std::vector<std::string> splitString(const std::string &line)
|
|||
}
|
||||
if (level > 1 && pos2 + 1 >= line.size())
|
||||
return std::vector<std::string> {};
|
||||
pos2 = line.find(" ", pos2);
|
||||
pos2 = line.find(' ', pos2);
|
||||
if (pos2 != std::string::npos)
|
||||
--pos2;
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ static std::vector<std::string> splitString(const std::string &line)
|
|||
break;
|
||||
}
|
||||
ret.push_back(line.substr(pos1, pos2+1-pos1));
|
||||
pos1 = line.find_first_not_of(" ", pos2 + 1);
|
||||
pos1 = line.find_first_not_of(' ', pos2 + 1);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -546,8 +546,8 @@ const ::Type * clangimport::AstNode::addTypeTokens(TokenList *tokenList, const s
|
|||
|
||||
std::string type;
|
||||
if (str.find(" (") != std::string::npos) {
|
||||
if (str.find("<") != std::string::npos)
|
||||
type = str.substr(1, str.find("<")) + "...>";
|
||||
if (str.find('<') != std::string::npos)
|
||||
type = str.substr(1, str.find('<')) + "...>";
|
||||
else
|
||||
type = str.substr(1,str.find(" (")-1);
|
||||
} else
|
||||
|
@ -557,8 +557,8 @@ const ::Type * clangimport::AstNode::addTypeTokens(TokenList *tokenList, const s
|
|||
type.erase(type.find("(*)("));
|
||||
type += "*";
|
||||
}
|
||||
if (type.find("(") != std::string::npos)
|
||||
type.erase(type.find("("));
|
||||
if (type.find('(') != std::string::npos)
|
||||
type.erase(type.find('('));
|
||||
|
||||
std::stack<Token *> lpar;
|
||||
for (const std::string &s: splitString(type)) {
|
||||
|
@ -620,7 +620,7 @@ void clangimport::AstNode::setValueType(Token *tok)
|
|||
for (int i = 0; i < 2; i++) {
|
||||
const std::string &type = getType(i);
|
||||
|
||||
if (type.find("<") != std::string::npos)
|
||||
if (type.find('<') != std::string::npos)
|
||||
// TODO
|
||||
continue;
|
||||
|
||||
|
@ -897,8 +897,8 @@ Token *clangimport::AstNode::createTokens(TokenList *tokenList)
|
|||
return newtok;
|
||||
}
|
||||
std::string type = getType();
|
||||
if (type.find("*") != std::string::npos)
|
||||
type = type.erase(type.rfind("*"));
|
||||
if (type.find('*') != std::string::npos)
|
||||
type = type.erase(type.rfind('*'));
|
||||
addTypeTokens(tokenList, type);
|
||||
if (!children.empty()) {
|
||||
Token *bracket1 = addtoken(tokenList, "[");
|
||||
|
@ -1577,7 +1577,7 @@ void clangimport::parseClangAstDump(Tokenizer *tokenizer, std::istream &f)
|
|||
std::string line;
|
||||
std::vector<AstNodePtr> tree;
|
||||
while (std::getline(f,line)) {
|
||||
const std::string::size_type pos1 = line.find("-");
|
||||
const std::string::size_type pos1 = line.find('-');
|
||||
if (pos1 == std::string::npos)
|
||||
continue;
|
||||
if (!tree.empty() && line.substr(pos1) == "-<<<NULL>>>") {
|
||||
|
@ -1585,7 +1585,7 @@ void clangimport::parseClangAstDump(Tokenizer *tokenizer, std::istream &f)
|
|||
tree[level - 1]->children.push_back(nullptr);
|
||||
continue;
|
||||
}
|
||||
const std::string::size_type pos2 = line.find(" ", pos1);
|
||||
const std::string::size_type pos2 = line.find(' ', pos1);
|
||||
if (pos2 < pos1 + 4 || pos2 == std::string::npos)
|
||||
continue;
|
||||
const std::string nodeType = line.substr(pos1+1, pos2 - pos1 - 1);
|
||||
|
|
|
@ -162,7 +162,7 @@ namespace {
|
|||
in >> json;
|
||||
return parseAddonInfo(json, fileName, exename);
|
||||
}
|
||||
if (fileName.find(".") == std::string::npos)
|
||||
if (fileName.find('.') == std::string::npos)
|
||||
return getAddonInfo(fileName + ".py", exename);
|
||||
|
||||
if (endsWith(fileName, ".py")) {
|
||||
|
@ -170,12 +170,12 @@ namespace {
|
|||
if (scriptFile.empty())
|
||||
return "Did not find addon " + fileName;
|
||||
|
||||
std::string::size_type pos1 = scriptFile.rfind("/");
|
||||
std::string::size_type pos1 = scriptFile.rfind('/');
|
||||
if (pos1 == std::string::npos)
|
||||
pos1 = 0;
|
||||
else
|
||||
pos1++;
|
||||
std::string::size_type pos2 = scriptFile.rfind(".");
|
||||
std::string::size_type pos2 = scriptFile.rfind('.');
|
||||
if (pos2 < pos1)
|
||||
pos2 = std::string::npos;
|
||||
name = scriptFile.substr(pos1, pos2 - pos1);
|
||||
|
@ -201,7 +201,7 @@ namespace {
|
|||
static std::string cmdFileName(std::string f)
|
||||
{
|
||||
f = Path::toNativeSeparators(f);
|
||||
if (f.find(" ") != std::string::npos)
|
||||
if (f.find(' ') != std::string::npos)
|
||||
return "\"" + f + "\"";
|
||||
return f;
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ static std::vector<std::string> split(const std::string &str, const std::string
|
|||
break;
|
||||
|
||||
if (str[startPos] == '\"') {
|
||||
const std::string::size_type endPos = str.find("\"", startPos + 1);
|
||||
const std::string::size_type endPos = str.find('\"', startPos + 1);
|
||||
ret.push_back(str.substr(startPos + 1, endPos - startPos - 1));
|
||||
startPos = (endPos < str.size()) ? (endPos + 1) : endPos;
|
||||
continue;
|
||||
|
@ -415,8 +415,8 @@ static bool reportClangErrors(std::istream &is, const std::function<void(const E
|
|||
continue;
|
||||
|
||||
// file:line:column: error: ....
|
||||
const std::string::size_type pos2 = line.rfind(":", pos3 - 1);
|
||||
const std::string::size_type pos1 = line.rfind(":", pos2 - 1);
|
||||
const std::string::size_type pos2 = line.rfind(':', pos3 - 1);
|
||||
const std::string::size_type pos1 = line.rfind(':', pos2 - 1);
|
||||
|
||||
if (pos1 >= pos2 || pos2 >= pos3)
|
||||
continue;
|
||||
|
@ -424,7 +424,7 @@ static bool reportClangErrors(std::istream &is, const std::function<void(const E
|
|||
const std::string filename = line.substr(0, pos1);
|
||||
const std::string linenr = line.substr(pos1+1, pos2-pos1-1);
|
||||
const std::string colnr = line.substr(pos2+1, pos3-pos2-1);
|
||||
const std::string msg = line.substr(line.find(":", pos3+1) + 2);
|
||||
const std::string msg = line.substr(line.find(':', pos3+1) + 2);
|
||||
|
||||
const std::string locFile = Path::toNativeSeparators(filename);
|
||||
ErrorMessage::FileLocation loc;
|
||||
|
@ -1701,8 +1701,8 @@ void CppCheck::analyseClangTidy(const ImportProject::FileSettings &fileSettings)
|
|||
endColumnPos = line.find(": warning:");
|
||||
}
|
||||
|
||||
const std::size_t endLinePos = line.rfind(":", endColumnPos-1);
|
||||
const std::size_t endNamePos = line.rfind(":", endLinePos - 1);
|
||||
const std::size_t endLinePos = line.rfind(':', endColumnPos-1);
|
||||
const std::size_t endNamePos = line.rfind(':', endLinePos - 1);
|
||||
const std::size_t endMsgTypePos = line.find(':', endColumnPos + 2);
|
||||
const std::size_t endErrorPos = line.rfind('[', std::string::npos);
|
||||
if (endLinePos==std::string::npos || endNamePos==std::string::npos || endMsgTypePos==std::string::npos || endErrorPos==std::string::npos)
|
||||
|
|
|
@ -118,8 +118,8 @@ ErrorMessage::ErrorMessage(const ErrorPath &errorPath, const TokenList *tokenLis
|
|||
const Token *tok = e.first;
|
||||
std::string info = e.second;
|
||||
|
||||
if (info.compare(0,8,"$symbol:") == 0 && info.find("\n") < info.size()) {
|
||||
const std::string::size_type pos = info.find("\n");
|
||||
if (info.compare(0,8,"$symbol:") == 0 && info.find('\n') < info.size()) {
|
||||
const std::string::size_type pos = info.find('\n');
|
||||
const std::string &symbolName = info.substr(8, pos - 8);
|
||||
info = replaceStr(info.substr(pos+1), "$symbol", symbolName);
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ void ErrorMessage::deserialize(const std::string &data)
|
|||
break;
|
||||
}
|
||||
const std::string::size_type start = pos;
|
||||
pos = temp.find("\t", pos);
|
||||
pos = temp.find('\t', pos);
|
||||
if (pos == std::string::npos) {
|
||||
substrings.push_back(temp.substr(start));
|
||||
break;
|
||||
|
|
|
@ -264,7 +264,7 @@ struct FwdAnalysis::Result FwdAnalysis::checkRecursive(const Token *expr, const
|
|||
// TODO: This is a quick bailout to avoid FP #9420, there are false negatives (TODO_ASSERT_EQUALS)
|
||||
return Result(Result::Type::BAILOUT);
|
||||
|
||||
if (expr->isName() && Token::Match(tok, "%name% (") && tok->str().find("<") != std::string::npos && tok->str().find(expr->str()) != std::string::npos)
|
||||
if (expr->isName() && Token::Match(tok, "%name% (") && tok->str().find('<') != std::string::npos && tok->str().find(expr->str()) != std::string::npos)
|
||||
return Result(Result::Type::BAILOUT);
|
||||
|
||||
if (exprVarIds.find(tok->varId()) != exprVarIds.end()) {
|
||||
|
|
|
@ -393,7 +393,7 @@ bool ImportProject::importCompileCommands(std::istream &istr)
|
|||
for (const picojson::value& arg : obj["arguments"].get<picojson::array>()) {
|
||||
if (arg.is<std::string>()) {
|
||||
std::string str = arg.get<std::string>();
|
||||
if (str.find(" ") != std::string::npos)
|
||||
if (str.find(' ') != std::string::npos)
|
||||
str = "\"" + str + "\"";
|
||||
command += str + " ";
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ static bool parseInlineSuppressionCommentToken(const simplecpp::Token *tok, std:
|
|||
return false;
|
||||
|
||||
// skip spaces after "cppcheck-suppress"
|
||||
const std::string::size_type pos2 = comment.find_first_not_of(" ", pos1+cppchecksuppress.size());
|
||||
const std::string::size_type pos2 = comment.find_first_not_of(' ', pos1+cppchecksuppress.size());
|
||||
if (pos2 == std::string::npos)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ static std::vector<std::string> getSummaryFiles(const std::string &filename)
|
|||
std::string line;
|
||||
while (std::getline(fin, line)) {
|
||||
const std::string::size_type dotA = line.find(".a");
|
||||
const std::string::size_type colon = line.find(":");
|
||||
const std::string::size_type colon = line.find(':');
|
||||
if (colon > line.size() || dotA > colon)
|
||||
continue;
|
||||
std::string f = line.substr(0,colon);
|
||||
|
@ -122,7 +122,7 @@ static std::vector<std::string> getSummaryData(const std::string &line, const st
|
|||
const std::string::size_type start = line.find(" " + data + ":[");
|
||||
if (start == std::string::npos)
|
||||
return ret;
|
||||
const std::string::size_type end = line.find("]", start);
|
||||
const std::string::size_type end = line.find(']', start);
|
||||
if (end >= line.size())
|
||||
return ret;
|
||||
|
||||
|
@ -172,7 +172,7 @@ void Summaries::loadReturn(const std::string &buildDir, std::set<std::string> &s
|
|||
while (std::getline(fin, line)) {
|
||||
// Get function name
|
||||
const std::string::size_type pos1 = 0;
|
||||
const std::string::size_type pos2 = line.find(" ", pos1);
|
||||
const std::string::size_type pos2 = line.find(' ', pos1);
|
||||
const std::string functionName = (pos2 == std::string::npos) ? line : line.substr(0, pos2);
|
||||
std::vector<std::string> call = getSummaryData(line, "call");
|
||||
functionCalls[functionName] = call;
|
||||
|
|
|
@ -123,8 +123,8 @@ std::vector<Suppressions::Suppression> Suppressions::parseMultiSuppressComment(c
|
|||
std::vector<Suppression> suppressions;
|
||||
|
||||
// If this function is called we assume that comment starts with "cppcheck-suppress[".
|
||||
const std::string::size_type start_position = comment.find("[");
|
||||
const std::string::size_type end_position = comment.find("]", start_position);
|
||||
const std::string::size_type start_position = comment.find('[');
|
||||
const std::string::size_type end_position = comment.find(']', start_position);
|
||||
if (end_position == std::string::npos) {
|
||||
if (errorMessage && errorMessage->empty())
|
||||
*errorMessage = "Bad multi suppression '" + comment + "'. legal format is cppcheck-suppress[errorId, errorId symbolName=arr, ...]";
|
||||
|
@ -134,7 +134,7 @@ std::vector<Suppressions::Suppression> Suppressions::parseMultiSuppressComment(c
|
|||
// parse all suppressions
|
||||
for (std::string::size_type pos = start_position; pos < end_position;) {
|
||||
const std::string::size_type pos1 = pos + 1;
|
||||
pos = comment.find(",", pos1);
|
||||
pos = comment.find(',', pos1);
|
||||
const std::string::size_type pos2 = (pos < end_position) ? pos : end_position;
|
||||
if (pos1 == pos2)
|
||||
continue;
|
||||
|
@ -179,7 +179,7 @@ std::string Suppressions::addSuppressionLine(const std::string &line)
|
|||
Suppressions::Suppression suppression;
|
||||
|
||||
// Strip any end of line comments
|
||||
std::string::size_type endpos = std::min(line.find("#"), line.find("//"));
|
||||
std::string::size_type endpos = std::min(line.find('#'), line.find("//"));
|
||||
if (endpos != std::string::npos) {
|
||||
while (endpos > 0 && std::isspace(line[endpos-1])) {
|
||||
endpos--;
|
||||
|
|
|
@ -2051,12 +2051,12 @@ Variable::Variable(const Token *name_, const std::string &clangType, const Token
|
|||
setFlag(fIsRValueRef, true);
|
||||
}
|
||||
|
||||
std::string::size_type pos = clangType.find("[");
|
||||
std::string::size_type pos = clangType.find('[');
|
||||
if (pos != std::string::npos) {
|
||||
setFlag(fIsArray, true);
|
||||
do {
|
||||
const std::string::size_type pos1 = pos+1;
|
||||
pos = clangType.find("]", pos1);
|
||||
pos = clangType.find(']', pos1);
|
||||
Dimension dim;
|
||||
dim.tok = nullptr;
|
||||
dim.known = pos > pos1;
|
||||
|
@ -6613,7 +6613,7 @@ static const Token* parsedecl(const Token* type,
|
|||
parsedecl(type->type()->typeStart, valuetype, defaultSignedness, settings, isCpp);
|
||||
else if (Token::Match(type, "const|constexpr"))
|
||||
valuetype->constness |= (1 << (valuetype->pointer - pointer0));
|
||||
else if (settings->clang && type->str().size() > 2 && type->str().find("::") < type->str().find("<")) {
|
||||
else if (settings->clang && type->str().size() > 2 && type->str().find("::") < type->str().find('<')) {
|
||||
TokenList typeTokens(settings);
|
||||
std::string::size_type pos1 = 0;
|
||||
do {
|
||||
|
|
|
@ -1514,7 +1514,7 @@ void TemplateSimplifier::addNamespace(const TokenAndName &templateDeclaration, c
|
|||
std::string::size_type end = 0;
|
||||
bool inTemplate = false;
|
||||
int level = 0;
|
||||
while ((end = templateDeclaration.scope().find(" ", start)) != std::string::npos) {
|
||||
while ((end = templateDeclaration.scope().find(' ', start)) != std::string::npos) {
|
||||
std::string token = templateDeclaration.scope().substr(start, end - start);
|
||||
// done if scopes overlap
|
||||
if (token == tokStart->str() && tok->strAt(-1) != "::")
|
||||
|
|
|
@ -1445,7 +1445,7 @@ void Tokenizer::simplifyTypedef()
|
|||
if (it->recordTypes.find(start->str()) != it->recordTypes.end()) {
|
||||
std::string::size_type spaceIdx = 0;
|
||||
std::string::size_type startIdx = 0;
|
||||
while ((spaceIdx = removed1.find(" ", startIdx)) != std::string::npos) {
|
||||
while ((spaceIdx = removed1.find(' ', startIdx)) != std::string::npos) {
|
||||
tok2->previous()->insertToken(removed1.substr(startIdx, spaceIdx - startIdx));
|
||||
startIdx = spaceIdx + 1;
|
||||
}
|
||||
|
@ -2548,7 +2548,7 @@ bool Tokenizer::simplifyUsing()
|
|||
tok1->deletePrevious();
|
||||
break;
|
||||
} else {
|
||||
const std::string::size_type idx = fullScope.rfind(" ");
|
||||
const std::string::size_type idx = fullScope.rfind(' ');
|
||||
|
||||
if (idx == std::string::npos)
|
||||
break;
|
||||
|
@ -2695,7 +2695,7 @@ bool Tokenizer::simplifyUsing()
|
|||
if (tempScope->recordTypes.find(start->str()) != tempScope->recordTypes.end()) {
|
||||
std::string::size_type spaceIdx = 0;
|
||||
std::string::size_type startIdx = 0;
|
||||
while ((spaceIdx = removed1.find(" ", startIdx)) != std::string::npos) {
|
||||
while ((spaceIdx = removed1.find(' ', startIdx)) != std::string::npos) {
|
||||
tok1->previous()->insertToken(removed1.substr(startIdx, spaceIdx - startIdx));
|
||||
startIdx = spaceIdx + 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue