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

Function typesMatch

lib/symboldatabase.cpp:3019–3049  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3017}
3018
3019static bool typesMatch(
3020 const Scope *first_scope,
3021 const Token *first_token,
3022 const Scope *second_scope,
3023 const Token *second_token,
3024 const Token *&new_first,
3025 const Token *&new_second)
3026{
3027 // get first type
3028 const Type* first_type = first_scope->symdb.findType(first_token, first_scope, /*lookOutside*/ true);
3029 if (first_type) {
3030 // get second type
3031 const Type* second_type = second_scope->symdb.findType(second_token, second_scope, /*lookOutside*/ true);
3032 // check if types match
3033 if (first_type == second_type) {
3034 const Token* tok1 = first_token;
3035 while (tok1 && tok1->str() != first_type->name())
3036 tok1 = tok1->next();
3037 const Token *tok2 = second_token;
3038 while (tok2 && tok2->str() != second_type->name())
3039 tok2 = tok2->next();
3040 // update parser token positions
3041 if (tok1 && tok2) {
3042 new_first = tok1->previous();
3043 new_second = tok2->previous();
3044 return true;
3045 }
3046 }
3047 }
3048 return false;
3049}
3050
3051bool Function::argsMatch(const Scope *scope, const Token *first, const Token *second, const std::string &path, nonneg int path_length) const
3052{

Callers 1

argsMatchMethod · 0.70

Calls 4

findTypeMethod · 0.80
nextMethod · 0.80
strMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected