[flang] Fix build issue with BUILD_SHARED_LIBS=ON

Define Fortran::Semantics::Scope::GetName in the header so it is available
to Fortran::Evaluate::Tool::AttachDeclaration without a circular dependency
introduced in 82edd42.

Reviewed By: tskeith

Differential Revision: https://reviews.llvm.org/D87505
This commit is contained in:
Richard Barton 2020-09-11 15:46:39 +01:00
parent 320624784c
commit d2c69c2f49
2 changed files with 9 additions and 9 deletions

View File

@ -95,7 +95,7 @@ public:
inline const Symbol *GetSymbol() const; inline const Symbol *GetSymbol() const;
const Scope *GetDerivedTypeParent() const; const Scope *GetDerivedTypeParent() const;
const Scope &GetDerivedTypeBase() const; const Scope &GetDerivedTypeBase() const;
std::optional<SourceName> GetName() const; inline std::optional<SourceName> GetName() const;
bool Contains(const Scope &) const; bool Contains(const Scope &) const;
/// Make a scope nested in this one /// Make a scope nested in this one
Scope &MakeScope(Kind kind, Symbol *symbol = nullptr); Scope &MakeScope(Kind kind, Symbol *symbol = nullptr);
@ -266,5 +266,13 @@ inline const Symbol *Scope::GetSymbol() const {
: nullptr; : nullptr;
} }
inline std::optional<SourceName> Scope::GetName() const {
if (const auto *sym{GetSymbol()}) {
return sym->name();
} else {
return std::nullopt;
}
}
} // namespace Fortran::semantics } // namespace Fortran::semantics
#endif // FORTRAN_SEMANTICS_SCOPE_H_ #endif // FORTRAN_SEMANTICS_SCOPE_H_

View File

@ -114,14 +114,6 @@ Symbol *Scope::FindComponent(SourceName name) const {
} }
} }
std::optional<SourceName> Scope::GetName() const {
if (const auto *sym{GetSymbol()}) {
return sym->name();
} else {
return std::nullopt;
}
}
bool Scope::Contains(const Scope &that) const { bool Scope::Contains(const Scope &that) const {
for (const Scope *scope{&that};; scope = &scope->parent()) { for (const Scope *scope{&that};; scope = &scope->parent()) {
if (*scope == *this) { if (*scope == *this) {