From 8b3783e2eacca6e0d7e478f59b882b5a89d17112 Mon Sep 17 00:00:00 2001 From: Tim Keith Date: Thu, 21 Feb 2019 19:14:28 -0800 Subject: [PATCH] [flang] Fix build problem with clang Moving one of the `Pre(ImplicitStmt)` functions up to `DeclarationVisitor` seemed to cause clang to complain that the `Pre` call from the `Walk` function was ambiguous. So this change moves it back to `ResolveNameVisitor`. Also, remove an unused variable that was causing a warning. Original-commit: flang-compiler/f18@766d000e2507d92b7774ad2c37732bafccc7cbcb Reviewed-on: https://github.com/flang-compiler/f18/pull/299 --- flang/lib/semantics/resolve-names.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/flang/lib/semantics/resolve-names.cc b/flang/lib/semantics/resolve-names.cc index 14929fb..376122e 100644 --- a/flang/lib/semantics/resolve-names.cc +++ b/flang/lib/semantics/resolve-names.cc @@ -619,7 +619,6 @@ public: using ArraySpecVisitor::Post; using ArraySpecVisitor::Pre; - bool Pre(const parser::ImplicitStmt &); void Post(const parser::EntityDecl &); void Post(const parser::ObjectDecl &); void Post(const parser::PointerDecl &); @@ -718,6 +717,7 @@ protected: void CheckScalarIntegerType(const parser::Name &); void CheckCommonBlocks(); void CheckSaveStmts(); + bool CheckNotInBlock(const char *); private: // The attribute corresponding to the statement containing an ObjectDecl @@ -751,7 +751,6 @@ private: // the interface name, if any. const parser::Name *interfaceName_{nullptr}; - bool CheckNotInBlock(const char *); bool HandleAttributeStmt(Attr, const std::list &); Symbol &HandleAttributeStmt(Attr, const parser::Name &); Symbol &DeclareUnknownEntity(const parser::Name &, Attrs); @@ -944,6 +943,7 @@ public: bool Pre(const parser::MainProgram &); void Post(const parser::EndProgramStmt &); void Post(const parser::Program &); + bool Pre(const parser::ImplicitStmt &); void Post(const parser::PointerObject &); void Post(const parser::AllocateObject &); void Post(const parser::PointerAssignmentStmt &); @@ -2461,10 +2461,6 @@ void DeclarationVisitor::Post(const parser::DimensionStmt::Declaration &x) { DeclareObjectEntity(name, Attrs{}); } -bool DeclarationVisitor::Pre(const parser::ImplicitStmt &x) { - return CheckNotInBlock("IMPLICIT") && ImplicitRulesVisitor::Pre(x); -} - void DeclarationVisitor::Post(const parser::EntityDecl &x) { // TODO: may be under StructureStmt const auto &name{std::get(x.t)}; @@ -3356,7 +3352,6 @@ void DeclarationVisitor::CheckSaveStmts() { // If SAVE attribute can't be set on symbol, return error message. std::optional DeclarationVisitor::CheckSaveAttr( const Symbol &symbol) { - std::optional msg; if (symbol.IsDummy()) { return "SAVE attribute may not be applied to dummy argument '%s'"_err_en_US; } else if (symbol.IsFuncResult()) { @@ -4428,6 +4423,10 @@ bool ResolveNamesVisitor::Pre(const parser::MainProgram &x) { void ResolveNamesVisitor::Post(const parser::EndProgramStmt &) { PopScope(); } +bool ResolveNamesVisitor::Pre(const parser::ImplicitStmt &x) { + return CheckNotInBlock("IMPLICIT") && ImplicitRulesVisitor::Pre(x); +} + void ResolveNamesVisitor::Post(const parser::PointerObject &x) { std::visit( common::visitors{ -- 2.7.4