diff --git a/flang/include/flang/Semantics/scope.h b/flang/include/flang/Semantics/scope.h --- a/flang/include/flang/Semantics/scope.h +++ b/flang/include/flang/Semantics/scope.h @@ -95,7 +95,7 @@ inline const Symbol *GetSymbol() const; const Scope *GetDerivedTypeParent() const; const Scope &GetDerivedTypeBase() const; - std::optional GetName() const; + inline std::optional GetName() const; bool Contains(const Scope &) const; /// Make a scope nested in this one Scope &MakeScope(Kind kind, Symbol *symbol = nullptr); @@ -266,5 +266,13 @@ : nullptr; } +inline std::optional Scope::GetName() const { + if (const auto *sym{GetSymbol()}) { + return sym->name(); + } else { + return std::nullopt; + } +} + } // namespace Fortran::semantics #endif // FORTRAN_SEMANTICS_SCOPE_H_ diff --git a/flang/lib/Semantics/scope.cpp b/flang/lib/Semantics/scope.cpp --- a/flang/lib/Semantics/scope.cpp +++ b/flang/lib/Semantics/scope.cpp @@ -114,14 +114,6 @@ } } -std::optional Scope::GetName() const { - if (const auto *sym{GetSymbol()}) { - return sym->name(); - } else { - return std::nullopt; - } -} - bool Scope::Contains(const Scope &that) const { for (const Scope *scope{&that};; scope = &scope->parent()) { if (*scope == *this) {