Improve --check-library error message (#4755)
This commit is contained in:
parent
9acc9659aa
commit
e8c3a80678
|
@ -2300,6 +2300,7 @@ 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())) {
|
if (pointedToType && astIsSmartPointer(var->nameToken())) {
|
||||||
const ValueType* vt = var->valueType();
|
const ValueType* vt = var->valueType();
|
||||||
if (vt && vt->smartPointerTypeToken)
|
if (vt && vt->smartPointerTypeToken)
|
||||||
|
@ -2312,7 +2313,6 @@ std::pair<const Token*, const Token*> Token::typeDecl(const Token* tok, bool poi
|
||||||
}
|
}
|
||||||
if (result.first)
|
if (result.first)
|
||||||
return result;
|
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