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

Function specMatch

lib/templatesimplifier.cpp:3491–3519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3489}
3490
3491static bool specMatch(
3492 const TemplateSimplifier::TokenAndName &spec,
3493 const TemplateSimplifier::TokenAndName &decl)
3494{
3495 // make sure decl is really a declaration
3496 if (decl.isPartialSpecialization() || decl.isSpecialization() || decl.isAlias() || decl.isFriend())
3497 return false;
3498
3499 if (!spec.isSameFamily(decl))
3500 return false;
3501
3502 // make sure the scopes and names match
3503 if (spec.fullName() == decl.fullName()) {
3504 if (spec.isFunction()) {
3505 std::vector<const Token*> specArgs;
3506 std::vector<const Token*> declArgs;
3507 getFunctionArguments(spec.nameToken(), specArgs);
3508 getFunctionArguments(decl.nameToken(), declArgs);
3509
3510 if (specArgs.size() == declArgs.size()) {
3511 // @todo make sure function parameters also match
3512 return true;
3513 }
3514 } else
3515 return true;
3516 }
3517
3518 return false;
3519}
3520
3521void TemplateSimplifier::getSpecializations()
3522{

Callers 2

getSpecializationsMethod · 0.85

Calls 10

getFunctionArgumentsFunction · 0.85
isSpecializationMethod · 0.80
isFriendMethod · 0.80
isSameFamilyMethod · 0.80
fullNameMethod · 0.80
isAliasMethod · 0.45
isFunctionMethod · 0.45
nameTokenMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected