From ca06058da81b9111050cc9832cfced3ce5a0e3ac Mon Sep 17 00:00:00 2001 From: Tim Keith Date: Wed, 10 Jul 2019 17:49:28 -0700 Subject: [PATCH] [flang] Fix formatting Original-commit: flang-compiler/f18@bef7ddd43b155417657aefaf284ffc1b28d2b8d6 Reviewed-on: https://github.com/flang-compiler/f18/pull/559 Tree-same-pre-rewrite: false --- flang/lib/semantics/resolve-names.cc | 178 ++++++++++++++------------- 1 file changed, 94 insertions(+), 84 deletions(-) diff --git a/flang/lib/semantics/resolve-names.cc b/flang/lib/semantics/resolve-names.cc index 1909bb4206d5..58fa73c39cbd 100644 --- a/flang/lib/semantics/resolve-names.cc +++ b/flang/lib/semantics/resolve-names.cc @@ -1188,11 +1188,12 @@ bool AttrsVisitor::SetPassNameOn(Symbol &symbol) { if (!passName_) { return false; } - std::visit(common::visitors{ - [&](ProcEntityDetails &x) { x.set_passName(*passName_); }, - [&](ProcBindingDetails &x) { x.set_passName(*passName_); }, - [](auto &) { common::die("unexpected pass name"); }, - }, + std::visit( + common::visitors{ + [&](ProcEntityDetails &x) { x.set_passName(*passName_); }, + [&](ProcBindingDetails &x) { x.set_passName(*passName_); }, + [](auto &) { common::die("unexpected pass name"); }, + }, symbol.details()); return true; } @@ -1344,22 +1345,23 @@ void ImplicitRulesVisitor::Post(const parser::ParameterStmt &x) { } bool ImplicitRulesVisitor::Pre(const parser::ImplicitStmt &x) { - bool res = std::visit(common::visitors{ - [&](const std::list &x) { - return HandleImplicitNone(x); - }, - [&](const std::list &x) { - if (prevImplicitNoneType_) { - Say("IMPLICIT statement after IMPLICIT NONE or " - "IMPLICIT NONE(TYPE) statement"_err_en_US); - return false; - } - return true; - }, - }, - x.u); + bool result{std::visit( + common::visitors{ + [&](const std::list &x) { + return HandleImplicitNone(x); + }, + [&](const std::list &x) { + if (prevImplicitNoneType_) { + Say("IMPLICIT statement after IMPLICIT NONE or " + "IMPLICIT NONE(TYPE) statement"_err_en_US); + return false; + } + return true; + }, + }, + x.u)}; prevImplicit_ = currStmtSource(); - return res; + return result; } bool ImplicitRulesVisitor::Pre(const parser::LetterSpec &x) { @@ -1688,17 +1690,18 @@ void ScopeHandler::EraseSymbol(const parser::Name &name) { static bool NeedsType(const Symbol &symbol) { return symbol.GetType() == nullptr && - std::visit(common::visitors{ - [](const EntityDetails &) { return true; }, - [](const ObjectEntityDetails &) { return true; }, - [](const AssocEntityDetails &) { return true; }, - [&](const ProcEntityDetails &p) { - return symbol.test(Symbol::Flag::Function) && - p.interface().type() == nullptr && - p.interface().symbol() == nullptr; - }, - [](const auto &) { return false; }, - }, + std::visit( + common::visitors{ + [](const EntityDetails &) { return true; }, + [](const ObjectEntityDetails &) { return true; }, + [](const AssocEntityDetails &) { return true; }, + [&](const ProcEntityDetails &p) { + return symbol.test(Symbol::Flag::Function) && + p.interface().type() == nullptr && + p.interface().symbol() == nullptr; + }, + [](const auto &) { return false; }, + }, symbol.details()); } void ScopeHandler::ApplyImplicitRules(Symbol &symbol) { @@ -1833,14 +1836,15 @@ void ModuleVisitor::Post(const parser::UseStmt &x) { // then add a use for each public name that was not renamed. std::set useNames; for (const auto &rename : *list) { - std::visit(common::visitors{ - [&](const parser::Rename::Names &names) { - useNames.insert(std::get<1>(names.t).source); - }, - [&](const parser::Rename::Operators &ops) { - useNames.insert(std::get<1>(ops.t).v.source); - }, - }, + std::visit( + common::visitors{ + [&](const parser::Rename::Names &names) { + useNames.insert(std::get<1>(names.t).source); + }, + [&](const parser::Rename::Operators &ops) { + useNames.insert(std::get<1>(ops.t).v.source); + }, + }, rename.u); } for (const auto &[name, symbol] : *useModuleScope_) { @@ -4147,16 +4151,17 @@ bool ConstructVisitor::Pre(const parser::DataImpliedDo &x) { } bool ConstructVisitor::Pre(const parser::DataStmtObject &x) { - std::visit(common::visitors{ - [&](const common::Indirection &y) { - Walk(y.value()); - }, - [&](const parser::DataImpliedDo &y) { - PushScope(Scope::Kind::ImpliedDos, nullptr); - Walk(y); - PopScope(); - }, - }, + std::visit( + common::visitors{ + [&](const common::Indirection &y) { + Walk(y.value()); + }, + [&](const parser::DataImpliedDo &y) { + PushScope(Scope::Kind::ImpliedDos, nullptr); + Walk(y); + PopScope(); + }, + }, x.u); return false; } @@ -4374,14 +4379,15 @@ void ConstructVisitor::SetAttrsFromAssociation(Symbol &symbol) { ConstructVisitor::Selector ConstructVisitor::ResolveSelector( const parser::Selector &x) { - return std::visit(common::visitors{ - [&](const parser::Expr &expr) { - return Selector{expr.source, EvaluateExpr(expr)}; - }, - [&](const parser::Variable &var) { - return Selector{var.GetSource(), EvaluateExpr(var)}; - }, - }, + return std::visit( + common::visitors{ + [&](const parser::Expr &expr) { + return Selector{expr.source, EvaluateExpr(expr)}; + }, + [&](const parser::Variable &var) { + return Selector{var.GetSource(), EvaluateExpr(var)}; + }, + }, x.u); } @@ -4511,12 +4517,13 @@ const parser::Name *DeclarationVisitor::ResolveVariable( [&](const common::Indirection &y) { const auto &proc{ std::get(y.value().v.t)}; - return std::visit(common::visitors{ - [&](const parser::Name &z) { return &z; }, - [&](const parser::ProcComponentRef &z) { - return ResolveStructureComponent(z.v.thing); - }, - }, + return std::visit( + common::visitors{ + [&](const parser::Name &z) { return &z; }, + [&](const parser::ProcComponentRef &z) { + return ResolveStructureComponent(z.v.thing); + }, + }, proc.u); }, }, @@ -4856,15 +4863,16 @@ bool ModuleVisitor::Pre(const parser::AccessStmt &x) { defaultAccess_ = accessAttr; } else { for (const auto &accessId : accessIds) { - std::visit(common::visitors{ - [=](const parser::Name &y) { - Resolve(y, SetAccess(y.source, accessAttr)); - }, - [=](const Indirection &y) { - auto info{GenericSpecInfo{y.value()}}; - info.Resolve(&SetAccess(info.symbolName(), accessAttr)); - }, - }, + std::visit( + common::visitors{ + [=](const parser::Name &y) { + Resolve(y, SetAccess(y.source, accessAttr)); + }, + [=](const Indirection &y) { + auto info{GenericSpecInfo{y.value()}}; + info.Resolve(&SetAccess(info.symbolName(), accessAttr)); + }, + }, accessId.u); } } @@ -4963,21 +4971,23 @@ bool ResolveNamesVisitor::Pre(const parser::ImplicitStmt &x) { } void ResolveNamesVisitor::Post(const parser::PointerObject &x) { - std::visit(common::visitors{ - [&](const parser::Name &x) { ResolveName(x); }, - [&](const parser::StructureComponent &x) { - ResolveStructureComponent(x); - }, - }, + std::visit( + common::visitors{ + [&](const parser::Name &x) { ResolveName(x); }, + [&](const parser::StructureComponent &x) { + ResolveStructureComponent(x); + }, + }, x.u); } void ResolveNamesVisitor::Post(const parser::AllocateObject &x) { - std::visit(common::visitors{ - [&](const parser::Name &x) { ResolveName(x); }, - [&](const parser::StructureComponent &x) { - ResolveStructureComponent(x); - }, - }, + std::visit( + common::visitors{ + [&](const parser::Name &x) { ResolveName(x); }, + [&](const parser::StructureComponent &x) { + ResolveStructureComponent(x); + }, + }, x.u); }