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)
|
||||
end = end->next();
|
||||
} else if (end->str() == "(") {
|
||||
if (tok->previous()->str().find("operator") == 0) {
|
||||
if (tok->previous()->str().compare(0, 8, "operator") == 0) {
|
||||
// conversion operator
|
||||
return false;
|
||||
} else if (tok->previous()->str() == "typedef") {
|
||||
|
@ -9922,19 +9922,10 @@ void Tokenizer::simplifyOperatorName()
|
|||
if (isC())
|
||||
return;
|
||||
|
||||
bool isUsingStmt = false;
|
||||
|
||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||
if (tok->str() == ";") {
|
||||
if (isUsingStmt && Token::Match(tok->tokAt(-3), "using|:: operator %op% ;")) {
|
||||
tok->previous()->previous()->str("operator" + tok->previous()->str());
|
||||
tok->deletePrevious();
|
||||
}
|
||||
isUsingStmt = false;
|
||||
continue;
|
||||
}
|
||||
if (tok->str() == "using") {
|
||||
isUsingStmt = true;
|
||||
if (Token::Match(tok, "using|:: operator %op% ;")) {
|
||||
tok->next()->str("operator" + tok->strAt(2));
|
||||
tok->next()->deleteNext();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -6193,8 +6193,11 @@ private:
|
|||
}
|
||||
|
||||
void simplifyOperatorName10() { // #8746
|
||||
const char code[] = "using a::operator=;";
|
||||
ASSERT_EQUALS("using a :: operator= ;", tokenizeAndStringify(code));
|
||||
const char code1[] = "using a::operator=;";
|
||||
ASSERT_EQUALS("using a :: operator= ;", tokenizeAndStringify(code1));
|
||||
|
||||
const char code2[] = "return &Fred::operator!=;";
|
||||
ASSERT_EQUALS("return & Fred :: operator!= ;", tokenizeAndStringify(code2));
|
||||
}
|
||||
|
||||
void simplifyOperatorName11() { // #8889
|
||||
|
|
Loading…
Reference in New Issue