Improve --check-library error message (#4755)
This commit is contained in:
parent
9acc9659aa
commit
e8c3a80678
|
@ -2300,19 +2300,19 @@ std::pair<const Token*, const Token*> Token::typeDecl(const Token* tok, bool poi
|
||||||
if (vt && vt->containerTypeToken)
|
if (vt && vt->containerTypeToken)
|
||||||
return { vt->containerTypeToken, vt->containerTypeToken->linkAt(-1) };
|
return { vt->containerTypeToken, vt->containerTypeToken->linkAt(-1) };
|
||||||
}
|
}
|
||||||
if (pointedToType && astIsSmartPointer(var->nameToken())) {
|
|
||||||
const ValueType* vt = var->valueType();
|
|
||||||
if (vt && vt->smartPointerTypeToken)
|
|
||||||
return { vt->smartPointerTypeToken, vt->smartPointerTypeToken->linkAt(-1) };
|
|
||||||
}
|
|
||||||
if (pointedToType && astIsIterator(var->nameToken())) {
|
|
||||||
const ValueType* vt = var->valueType();
|
|
||||||
if (vt && vt->containerTypeToken)
|
|
||||||
return { vt->containerTypeToken, vt->containerTypeToken->linkAt(-1) };
|
|
||||||
}
|
|
||||||
if (result.first)
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
if (pointedToType && astIsSmartPointer(var->nameToken())) {
|
||||||
|
const ValueType* vt = var->valueType();
|
||||||
|
if (vt && vt->smartPointerTypeToken)
|
||||||
|
return { vt->smartPointerTypeToken, vt->smartPointerTypeToken->linkAt(-1) };
|
||||||
|
}
|
||||||
|
if (pointedToType && astIsIterator(var->nameToken())) {
|
||||||
|
const ValueType* vt = var->valueType();
|
||||||
|
if (vt && vt->containerTypeToken)
|
||||||
|
return { vt->containerTypeToken, vt->containerTypeToken->linkAt(-1) };
|
||||||
|
}
|
||||||
|
if (result.first)
|
||||||
|
return result;
|
||||||
return {var->typeStartToken(), var->typeEndToken()->next()};
|
return {var->typeStartToken(), var->typeEndToken()->next()};
|
||||||
} else if (Token::simpleMatch(tok, "return")) {
|
} else if (Token::simpleMatch(tok, "return")) {
|
||||||
const Scope* scope = tok->scope();
|
const Scope* scope = tok->scope();
|
||||||
|
|
|
@ -1949,6 +1949,16 @@ private:
|
||||||
"[test.cpp:5]: (information) --check-library: There is no matching configuration for function auto::push_back()\n",
|
"[test.cpp:5]: (information) --check-library: There is no matching configuration for function auto::push_back()\n",
|
||||||
errout.str());
|
errout.str());
|
||||||
|
|
||||||
|
check("struct F { void g(int); };\n"
|
||||||
|
"void f(std::list<F>& l) {\n"
|
||||||
|
" std::list<F>::iterator it;\n"
|
||||||
|
" for (it = l.begin(); it != l.end(); ++it)\n"
|
||||||
|
" it->g(0);\n"
|
||||||
|
"}\n");
|
||||||
|
TODO_ASSERT_EQUALS("",
|
||||||
|
"[test.cpp:5]: (information) --check-library: There is no matching configuration for function F::g()\n",
|
||||||
|
errout.str());
|
||||||
|
|
||||||
settings = settings_old;
|
settings = settings_old;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue