[flang-commits] [PATCH] D159365: [flang][runtime] Avoid std::reference_wrapper<> in flang/runtime

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Sep 1 09:53:47 PDT 2023


klausler created this revision.
klausler added a reviewer: mmuetzel.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a reviewer: sscalpone.
Herald added a project: All.
klausler requested review of this revision.

std::reference_wrapper<>::get() might induce a dependency on
__libcpp_verbose_abort().  Replace std::reference_wrapper<>
with Fortran::common::Reference<>, which has no such dependency.


https://reviews.llvm.org/D159365

Files:
  flang/runtime/io-stmt.h


Index: flang/runtime/io-stmt.h
===================================================================
--- flang/runtime/io-stmt.h
+++ flang/runtime/io-stmt.h
@@ -16,6 +16,7 @@
 #include "format.h"
 #include "internal-unit.h"
 #include "io-error.h"
+#include "flang/Common/reference.h"
 #include "flang/Common/visit.h"
 #include "flang/Runtime/descriptor.h"
 #include "flang/Runtime/io-api.h"
@@ -200,39 +201,31 @@
   }
 
 private:
-  std::variant<std::reference_wrapper<OpenStatementState>,
-      std::reference_wrapper<CloseStatementState>,
-      std::reference_wrapper<NoopStatementState>,
-      std::reference_wrapper<
-          InternalFormattedIoStatementState<Direction::Output>>,
-      std::reference_wrapper<
-          InternalFormattedIoStatementState<Direction::Input>>,
-      std::reference_wrapper<InternalListIoStatementState<Direction::Output>>,
-      std::reference_wrapper<InternalListIoStatementState<Direction::Input>>,
-      std::reference_wrapper<
-          ExternalFormattedIoStatementState<Direction::Output>>,
-      std::reference_wrapper<
-          ExternalFormattedIoStatementState<Direction::Input>>,
-      std::reference_wrapper<ExternalListIoStatementState<Direction::Output>>,
-      std::reference_wrapper<ExternalListIoStatementState<Direction::Input>>,
-      std::reference_wrapper<
-          ExternalUnformattedIoStatementState<Direction::Output>>,
-      std::reference_wrapper<
-          ExternalUnformattedIoStatementState<Direction::Input>>,
-      std::reference_wrapper<ChildFormattedIoStatementState<Direction::Output>>,
-      std::reference_wrapper<ChildFormattedIoStatementState<Direction::Input>>,
-      std::reference_wrapper<ChildListIoStatementState<Direction::Output>>,
-      std::reference_wrapper<ChildListIoStatementState<Direction::Input>>,
-      std::reference_wrapper<
-          ChildUnformattedIoStatementState<Direction::Output>>,
-      std::reference_wrapper<
-          ChildUnformattedIoStatementState<Direction::Input>>,
-      std::reference_wrapper<InquireUnitState>,
-      std::reference_wrapper<InquireNoUnitState>,
-      std::reference_wrapper<InquireUnconnectedFileState>,
-      std::reference_wrapper<InquireIOLengthState>,
-      std::reference_wrapper<ExternalMiscIoStatementState>,
-      std::reference_wrapper<ErroneousIoStatementState>>
+  std::variant<common::Reference<OpenStatementState>,
+      common::Reference<CloseStatementState>,
+      common::Reference<NoopStatementState>,
+      common::Reference<InternalFormattedIoStatementState<Direction::Output>>,
+      common::Reference<InternalFormattedIoStatementState<Direction::Input>>,
+      common::Reference<InternalListIoStatementState<Direction::Output>>,
+      common::Reference<InternalListIoStatementState<Direction::Input>>,
+      common::Reference<ExternalFormattedIoStatementState<Direction::Output>>,
+      common::Reference<ExternalFormattedIoStatementState<Direction::Input>>,
+      common::Reference<ExternalListIoStatementState<Direction::Output>>,
+      common::Reference<ExternalListIoStatementState<Direction::Input>>,
+      common::Reference<ExternalUnformattedIoStatementState<Direction::Output>>,
+      common::Reference<ExternalUnformattedIoStatementState<Direction::Input>>,
+      common::Reference<ChildFormattedIoStatementState<Direction::Output>>,
+      common::Reference<ChildFormattedIoStatementState<Direction::Input>>,
+      common::Reference<ChildListIoStatementState<Direction::Output>>,
+      common::Reference<ChildListIoStatementState<Direction::Input>>,
+      common::Reference<ChildUnformattedIoStatementState<Direction::Output>>,
+      common::Reference<ChildUnformattedIoStatementState<Direction::Input>>,
+      common::Reference<InquireUnitState>,
+      common::Reference<InquireNoUnitState>,
+      common::Reference<InquireUnconnectedFileState>,
+      common::Reference<InquireIOLengthState>,
+      common::Reference<ExternalMiscIoStatementState>,
+      common::Reference<ErroneousIoStatementState>>
       u_;
 };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159365.555421.patch
Type: text/x-patch
Size: 4030 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230901/46b126dd/attachment.bin>


More information about the flang-commits mailing list