From b8efe4bf11a6123e7fde8f906787231ee64f275c Mon Sep 17 00:00:00 2001 From: Tim Keith Date: Fri, 31 Aug 2018 15:15:28 -0700 Subject: [PATCH] [flang] Change BeginAttrs to return true like BeginDecl This is just for convenience. Any Pre function that calls BeginAttrs must return true. Original-commit: flang-compiler/f18@5a7bc11ba43f0e0d0dbdfe845f06c86274fde8ad Reviewed-on: https://github.com/flang-compiler/f18/pull/173 Tree-same-pre-rewrite: false --- flang/lib/semantics/resolve-names.cc | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/flang/lib/semantics/resolve-names.cc b/flang/lib/semantics/resolve-names.cc index 239fd68a3cc8..bb3b386cc737 100644 --- a/flang/lib/semantics/resolve-names.cc +++ b/flang/lib/semantics/resolve-names.cc @@ -79,7 +79,7 @@ private: // Provide Post methods to collect attributes into a member variable. class AttrsVisitor { public: - void BeginAttrs(); + bool BeginAttrs(); Attrs GetAttrs(); Attrs EndAttrs(); void Post(const parser::LanguageBindingSpec &); @@ -762,9 +762,10 @@ void ShowImplicitRule( // AttrsVisitor implementation -void AttrsVisitor::BeginAttrs() { +bool AttrsVisitor::BeginAttrs() { CHECK(!attrs_); attrs_ = std::make_optional(); + return true; } Attrs AttrsVisitor::GetAttrs() { CHECK(attrs_); @@ -1717,16 +1718,14 @@ void SubprogramVisitor::Post(const parser::InterfaceBody::Function &) { } bool SubprogramVisitor::Pre(const parser::SubroutineStmt &stmt) { - BeginAttrs(); - return true; + return BeginAttrs(); } bool SubprogramVisitor::Pre(const parser::FunctionStmt &stmt) { if (!subpNamesOnly_) { BeginDeclTypeSpec(); CHECK(!funcResultName_); } - BeginAttrs(); - return true; + return BeginAttrs(); } void SubprogramVisitor::Post(const parser::SubroutineStmt &stmt) { @@ -1848,14 +1847,13 @@ Symbol *SubprogramVisitor::GetSpecificFromGeneric(const SourceName &name) { bool DeclarationVisitor::BeginDecl() { BeginDeclTypeSpec(); - BeginAttrs(); BeginArraySpec(); - return true; + return BeginAttrs(); } void DeclarationVisitor::EndDecl() { EndDeclTypeSpec(); - EndAttrs(); EndArraySpec(); + EndAttrs(); } bool DeclarationVisitor::CheckUseError( @@ -2036,8 +2034,7 @@ void DeclarationVisitor::Post(const parser::DerivedTypeDef &x) { derivedTypeData_.reset(); } bool DeclarationVisitor::Pre(const parser::DerivedTypeStmt &x) { - BeginAttrs(); - return true; + return BeginAttrs(); } void DeclarationVisitor::Post(const parser::DerivedTypeStmt &x) { auto &name{std::get(x.t).source};