Fixed clang-tidy warnings

This commit is contained in:
Bartek Kryza
2023-04-05 22:55:54 +02:00
parent 38928cf86f
commit ade1f76640
2 changed files with 13 additions and 7 deletions

View File

@@ -2597,7 +2597,8 @@ translation_unit_visitor::get_template_argument_from_type_parameter_string(
{
if (const auto *template_decl =
llvm::dyn_cast<clang::ClassTemplateSpecializationDecl>(decl);
template_decl && return_type_name.find("type-parameter-") == 0) {
template_decl != nullptr &&
return_type_name.find("type-parameter-") == 0) {
[[maybe_unused]] const auto [depth, index] =
common::extract_template_parameter_index(return_type_name);

View File

@@ -113,14 +113,19 @@ int template_parameter::calculate_specialization_match(
{
int res{0};
if (base_template_parameter.type().has_value() && type().has_value() &&
auto maybe_base_template_parameter_type = base_template_parameter.type();
auto maybe_template_parameter_type = type();
if (maybe_base_template_parameter_type.has_value() &&
maybe_template_parameter_type.has_value() &&
!base_template_parameter.is_template_parameter() &&
!is_template_parameter()) {
if (base_template_parameter.type().value() != type().value())
if (maybe_base_template_parameter_type.value() !=
maybe_template_parameter_type.value())
return 0;
else
res++;
res++;
}
if (base_template_parameter.is_function_template() &&
@@ -389,8 +394,8 @@ int calculate_template_params_specialization_match(
return res;
}
else
return 0;
return 0;
}
return 0;