[flang-commits] [flang] d2c69c2 - [flang] Fix build issue with BUILD_SHARED_LIBS=ON

Richard Barton via flang-commits flang-commits at lists.llvm.org
Fri Sep 11 08:14:17 PDT 2020


Author: Richard Barton
Date: 2020-09-11T16:14:00+01:00
New Revision: d2c69c2f4947b38832a34cab14fe32c6b94dd4d2

URL: https://github.com/llvm/llvm-project/commit/d2c69c2f4947b38832a34cab14fe32c6b94dd4d2
DIFF: https://github.com/llvm/llvm-project/commit/d2c69c2f4947b38832a34cab14fe32c6b94dd4d2.diff

LOG: [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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Semantics/scope.h b/flang/include/flang/Semantics/scope.h
index 853d7044f7fd..fd2198b2ae61 100644
--- a/flang/include/flang/Semantics/scope.h
+++ b/flang/include/flang/Semantics/scope.h
@@ -95,7 +95,7 @@ class Scope {
   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 @@ inline const Symbol *Scope::GetSymbol() const {
                          : 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_

diff  --git a/flang/lib/Semantics/scope.cpp b/flang/lib/Semantics/scope.cpp
index c7635c0b1a3b..768f9f5aab1b 100644
--- a/flang/lib/Semantics/scope.cpp
+++ b/flang/lib/Semantics/scope.cpp
@@ -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 {
   for (const Scope *scope{&that};; scope = &scope->parent()) {
     if (*scope == *this) {


        


More information about the flang-commits mailing list