[PATCH] D87505: [flang] Fix build issue with BUILD_SHARED_LIBS=ON

Richard Barton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 11 04:15:34 PDT 2020


richard.barton.arm created this revision.
richard.barton.arm added a reviewer: tskeith.
Herald added a reviewer: DavidTruby.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
richard.barton.arm requested review of this revision.

Define Fortran::Semantics::Scope::GetName in the header so it is available
to Fortran::Evaluate::Tool::AttachDeclaration without a circular dependency
introduced in 82edd42 <https://reviews.llvm.org/rG82edd428f1856ff386716b4f836194252458d001>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87505

Files:
  flang/include/flang/Semantics/scope.h
  flang/lib/Semantics/scope.cpp


Index: flang/lib/Semantics/scope.cpp
===================================================================
--- flang/lib/Semantics/scope.cpp
+++ flang/lib/Semantics/scope.cpp
@@ -114,14 +114,6 @@
   }
 }
 
-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 {
   for (const Scope *scope{&that};; scope = &scope->parent()) {
     if (*scope == *this) {
Index: flang/include/flang/Semantics/scope.h
===================================================================
--- flang/include/flang/Semantics/scope.h
+++ 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<SourceName> GetName() const;
+  inline std::optional<SourceName> 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<SourceName> Scope::GetName() const {
+  if (const auto *sym{GetSymbol()}) {
+    return sym->name();
+  } else {
+    return std::nullopt;
+  }
+}
+
 } // namespace Fortran::semantics
 #endif // FORTRAN_SEMANTICS_SCOPE_H_


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87505.291180.patch
Type: text/x-patch
Size: 1399 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200911/3e47256b/attachment.bin>


More information about the llvm-commits mailing list