MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / hasMatchingConstructor

Function hasMatchingConstructor

lib/symboldatabase.cpp:5983–5999  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5981}
5982
5983static bool hasMatchingConstructor(const Scope* classScope, const ValueType* argType) {
5984 if (!classScope || !argType)
5985 return false;
5986 return std::any_of(classScope->functionList.cbegin(),
5987 classScope->functionList.cend(),
5988 [&](const Function& f) {
5989 if (!f.isConstructor() || f.argCount() != 1 || !f.getArgumentVar(0))
5990 return false;
5991 const ValueType* vt = f.getArgumentVar(0)->valueType();
5992 return vt &&
5993 vt->type == argType->type &&
5994 (argType->sign == ValueType::Sign::UNKNOWN_SIGN || vt->sign == argType->sign) &&
5995 vt->pointer == argType->pointer &&
5996 (vt->constness & 1) >= (argType->constness & 1) &&
5997 (vt->volatileness & 1) >= (argType->volatileness & 1);
5998 });
5999}
6000
6001const Function* Scope::findFunction(const Token *tok, bool requireConst, Reference ref) const
6002{

Callers 1

findFunctionMethod · 0.85

Calls 1

getArgumentVarMethod · 0.80

Tested by

no test coverage detected