Fixed knownArgument false positive for pointer
This commit is contained in:
parent
c08e1a9a94
commit
801cc8d331
|
@ -3120,7 +3120,7 @@ void CheckOther::checkKnownArgument()
|
||||||
std::string varexpr;
|
std::string varexpr;
|
||||||
visitAstNodes(tok, [&varexpr](const Token *child) {
|
visitAstNodes(tok, [&varexpr](const Token *child) {
|
||||||
if (Token::Match(child, "%var%|.|[")) {
|
if (Token::Match(child, "%var%|.|[")) {
|
||||||
if (child->valueType() && child->valueType()->isIntegral() && child->values().empty()) {
|
if (child->valueType() && child->valueType()->pointer == 0 && child->valueType()->isIntegral() && child->values().empty()) {
|
||||||
varexpr = child->expressionString();
|
varexpr = child->expressionString();
|
||||||
return ChildrenToVisit::done;
|
return ChildrenToVisit::done;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8837,6 +8837,11 @@ private:
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
check("void foo(char *c) {\n"
|
||||||
|
" if (*c == '+' && (operand || !isalnum(*c))) {}\n"
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
// #8986
|
// #8986
|
||||||
check("void f(int);\n"
|
check("void f(int);\n"
|
||||||
"void g() {\n"
|
"void g() {\n"
|
||||||
|
|
Loading…
Reference in New Issue