Applied readability-qualified-auto clang-tidy fixes

This commit is contained in:
Bartek Kryza
2022-12-22 17:17:18 +01:00
parent ebf87d2161
commit d83a1f1805
2 changed files with 11 additions and 11 deletions

View File

@@ -255,7 +255,7 @@ bool translation_unit_visitor::VisitTypeAliasTemplateDecl(
cls->getQualifiedNameAsString(), cls->getQualifiedNameAsString(),
cls->getLocation().printToString(source_manager())); cls->getLocation().printToString(source_manager()));
auto *template_type_specialization_ptr = const auto *template_type_specialization_ptr =
cls->getTemplatedDecl() cls->getTemplatedDecl()
->getUnderlyingType() ->getUnderlyingType()
->getAs<clang::TemplateSpecializationType>(); ->getAs<clang::TemplateSpecializationType>();
@@ -618,7 +618,7 @@ void translation_unit_visitor::process_record_containment(
void translation_unit_visitor::process_class_bases( void translation_unit_visitor::process_class_bases(
const clang::CXXRecordDecl *cls, class_ &c) const clang::CXXRecordDecl *cls, class_ &c)
{ {
for (auto &base : cls->bases()) { for (const auto &base : cls->bases()) {
class_parent cp; class_parent cp;
auto name_and_ns = common::model::namespace_{ auto name_and_ns = common::model::namespace_{
common::to_string(base.getType(), cls->getASTContext())}; common::to_string(base.getType(), cls->getASTContext())};
@@ -1481,14 +1481,14 @@ std::unique_ptr<class_> translation_unit_visitor::build_template_instantiation(
/*is variadic */ bool>> /*is variadic */ bool>>
template_base_params{}; template_base_params{};
auto *template_type_ptr = &template_type_decl; const auto *template_type_ptr = &template_type_decl;
if (template_type_decl.isTypeAlias() && if (template_type_decl.isTypeAlias() &&
(template_type_decl.getAliasedType() (template_type_decl.getAliasedType()
->getAs<clang::TemplateSpecializationType>() != nullptr)) ->getAs<clang::TemplateSpecializationType>() != nullptr))
template_type_ptr = template_type_decl.getAliasedType() template_type_ptr = template_type_decl.getAliasedType()
->getAs<clang::TemplateSpecializationType>(); ->getAs<clang::TemplateSpecializationType>();
auto &template_type = *template_type_ptr; const auto &template_type = *template_type_ptr;
// //
// Create class_ instance to hold the template instantiation // Create class_ instance to hold the template instantiation
@@ -2129,7 +2129,7 @@ void translation_unit_visitor::resolve_local_to_global_ids()
{ {
// TODO: Refactor to a map with relationships attached to references // TODO: Refactor to a map with relationships attached to references
// to elements // to elements
for (auto &cls : diagram().classes()) { for (const auto &cls : diagram().classes()) {
for (auto &rel : cls.get().relationships()) { for (auto &rel : cls.get().relationships()) {
if (rel.type() == relationship_t::kInstantiation) { if (rel.type() == relationship_t::kInstantiation) {
const auto maybe_local_id = rel.destination(); const auto maybe_local_id = rel.destination();

View File

@@ -1000,7 +1000,7 @@ bool translation_unit_visitor::process_class_method_call_expression(
std::string method_name = method_decl->getQualifiedNameAsString(); std::string method_name = method_decl->getQualifiedNameAsString();
auto *callee_decl = const auto *callee_decl =
method_decl != nullptr ? method_decl->getParent() : nullptr; method_decl != nullptr ? method_decl->getParent() : nullptr;
if (callee_decl == nullptr) if (callee_decl == nullptr)
@@ -1026,7 +1026,7 @@ bool translation_unit_visitor::process_class_method_call_expression(
bool translation_unit_visitor::process_class_template_method_call_expression( bool translation_unit_visitor::process_class_template_method_call_expression(
model::message &m, const clang::CallExpr *expr) model::message &m, const clang::CallExpr *expr)
{ {
auto *dependent_member_callee = const auto *dependent_member_callee =
clang::dyn_cast_or_null<clang::CXXDependentScopeMemberExpr>( clang::dyn_cast_or_null<clang::CXXDependentScopeMemberExpr>(
expr->getCallee()); expr->getCallee());
@@ -1145,7 +1145,7 @@ bool translation_unit_visitor::process_unresolved_lookup_call_expression(
model::message &m, const clang::CallExpr *expr) model::message &m, const clang::CallExpr *expr)
{ {
// This is probably a template // This is probably a template
auto *unresolved_expr = const auto *unresolved_expr =
clang::dyn_cast_or_null<clang::UnresolvedLookupExpr>(expr->getCallee()); clang::dyn_cast_or_null<clang::UnresolvedLookupExpr>(expr->getCallee());
if (unresolved_expr != nullptr) { if (unresolved_expr != nullptr) {
@@ -1153,7 +1153,7 @@ bool translation_unit_visitor::process_unresolved_lookup_call_expression(
if (clang::dyn_cast_or_null<clang::FunctionTemplateDecl>(decl) != if (clang::dyn_cast_or_null<clang::FunctionTemplateDecl>(decl) !=
nullptr) { nullptr) {
// Yes, it's a template // Yes, it's a template
auto *ftd = const auto *ftd =
clang::dyn_cast_or_null<clang::FunctionTemplateDecl>(decl); clang::dyn_cast_or_null<clang::FunctionTemplateDecl>(decl);
if (!get_unique_id(ftd->getID()).has_value()) if (!get_unique_id(ftd->getID()).has_value())
@@ -1820,14 +1820,14 @@ translation_unit_visitor::build_template_instantiation(
/*is variadic */ bool>> /*is variadic */ bool>>
template_base_params{}; template_base_params{};
auto *template_type_ptr = &template_type_decl; const auto *template_type_ptr = &template_type_decl;
if (template_type_decl.isTypeAlias() && if (template_type_decl.isTypeAlias() &&
(template_type_decl.getAliasedType() (template_type_decl.getAliasedType()
->getAs<clang::TemplateSpecializationType>() != nullptr)) ->getAs<clang::TemplateSpecializationType>() != nullptr))
template_type_ptr = template_type_decl.getAliasedType() template_type_ptr = template_type_decl.getAliasedType()
->getAs<clang::TemplateSpecializationType>(); ->getAs<clang::TemplateSpecializationType>();
auto &template_type = *template_type_ptr; const auto &template_type = *template_type_ptr;
// //
// Create class_ instance to hold the template instantiation // Create class_ instance to hold the template instantiation