Fixed #9027 (cppcheck on Centos 7 - segmentation fault below CheckCondition::multiCondition2)
This commit is contained in:
parent
c8003d47e2
commit
75ce67f4b8
|
@ -242,7 +242,7 @@ bool Tokenizer::duplicateTypedef(Token **tokPtr, const Token *name, const Token
|
||||||
if (end)
|
if (end)
|
||||||
end = end->next();
|
end = end->next();
|
||||||
} else if (end->str() == "(") {
|
} else if (end->str() == "(") {
|
||||||
if (tok->previous()->str().find("operator") == 0) {
|
if (tok->previous()->str().compare(0, 8, "operator") == 0) {
|
||||||
// conversion operator
|
// conversion operator
|
||||||
return false;
|
return false;
|
||||||
} else if (tok->previous()->str() == "typedef") {
|
} else if (tok->previous()->str() == "typedef") {
|
||||||
|
@ -9922,19 +9922,10 @@ void Tokenizer::simplifyOperatorName()
|
||||||
if (isC())
|
if (isC())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool isUsingStmt = false;
|
|
||||||
|
|
||||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||||
if (tok->str() == ";") {
|
if (Token::Match(tok, "using|:: operator %op% ;")) {
|
||||||
if (isUsingStmt && Token::Match(tok->tokAt(-3), "using|:: operator %op% ;")) {
|
tok->next()->str("operator" + tok->strAt(2));
|
||||||
tok->previous()->previous()->str("operator" + tok->previous()->str());
|
tok->next()->deleteNext();
|
||||||
tok->deletePrevious();
|
|
||||||
}
|
|
||||||
isUsingStmt = false;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (tok->str() == "using") {
|
|
||||||
isUsingStmt = true;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6193,8 +6193,11 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void simplifyOperatorName10() { // #8746
|
void simplifyOperatorName10() { // #8746
|
||||||
const char code[] = "using a::operator=;";
|
const char code1[] = "using a::operator=;";
|
||||||
ASSERT_EQUALS("using a :: operator= ;", tokenizeAndStringify(code));
|
ASSERT_EQUALS("using a :: operator= ;", tokenizeAndStringify(code1));
|
||||||
|
|
||||||
|
const char code2[] = "return &Fred::operator!=;";
|
||||||
|
ASSERT_EQUALS("return & Fred :: operator!= ;", tokenizeAndStringify(code2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void simplifyOperatorName11() { // #8889
|
void simplifyOperatorName11() { // #8889
|
||||||
|
|
Loading…
Reference in New Issue