[flang-commits] [PATCH] D88109: [flang][msvc] Avoid ReferenceVariantBase ctor ambiguity. NFC.

Michael Kruse via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Sep 29 15:41:42 PDT 2020


Meinersbur updated this revision to Diff 295138.
Meinersbur added a comment.

- Adhere flang variable naming scheme


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88109/new/

https://reviews.llvm.org/D88109

Files:
  flang/include/flang/Lower/PFTBuilder.h
  flang/lib/Lower/PFTBuilder.cpp


Index: flang/lib/Lower/PFTBuilder.cpp
===================================================================
--- flang/lib/Lower/PFTBuilder.cpp
+++ flang/lib/Lower/PFTBuilder.cpp
@@ -64,8 +64,11 @@
 class PFTBuilder {
 public:
   PFTBuilder(const semantics::SemanticsContext &semanticsContext)
-      : pgm{std::make_unique<lower::pft::Program>()},
-        parentVariantStack{*pgm.get()}, semanticsContext{semanticsContext} {}
+      : pgm{std::make_unique<lower::pft::Program>()}, semanticsContext{
+                                                          semanticsContext} {
+    lower::pft::ParentVariant y{*pgm.get()};
+    parentVariantStack.push_back(y);
+  }
 
   /// Get the result
   std::unique_ptr<lower::pft::Program> result() { return std::move(pgm); }
@@ -905,11 +908,15 @@
 template <typename A, typename T>
 static lower::pft::FunctionLikeUnit::FunctionStatement
 getFunctionStmt(const T &func) {
-  return std::get<parser::Statement<A>>(func.t);
+  lower::pft::FunctionLikeUnit::FunctionStatement result{
+      std::get<parser::Statement<A>>(func.t)};
+  return Res;
 }
 template <typename A, typename T>
 static lower::pft::ModuleLikeUnit::ModuleStatement getModuleStmt(const T &mod) {
-  return std::get<parser::Statement<A>>(mod.t);
+  lower::pft::ModuleLikeUnit::ModuleStatement result{
+      std::get<parser::Statement<A>>(mod.t)};
+  return Res;
 }
 
 static const semantics::Symbol *getSymbol(
@@ -1078,7 +1085,8 @@
   const auto &ps{
       std::get<std::optional<parser::Statement<parser::ProgramStmt>>>(func.t)};
   if (ps.has_value()) {
-    beginStmt = ps.value();
+    FunctionStatement begin{ps.value()};
+    beginStmt = begin;
     symbol = getSymbol(beginStmt);
     processSymbolTable(*symbol->scope());
   } else {
Index: flang/include/flang/Lower/PFTBuilder.h
===================================================================
--- flang/include/flang/Lower/PFTBuilder.h
+++ flang/include/flang/Lower/PFTBuilder.h
@@ -55,8 +55,9 @@
   using Ref = common::Reference<BaseType<B>>;
 
   ReferenceVariantBase() = delete;
-  template <typename B>
-  ReferenceVariantBase(B &b) : u{Ref<B>{b}} {}
+  ReferenceVariantBase(std::variant<Ref<A>...> b) : u(b) {}
+  template <typename T>
+  ReferenceVariantBase(Ref<T> b) : u(b) {}
 
   template <typename B>
   constexpr BaseType<B> &get() const {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88109.295138.patch
Type: text/x-patch
Size: 2326 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20200929/0ed3170b/attachment-0001.bin>


More information about the flang-commits mailing list