[flang-commits] [PATCH] D144046: [flang][runtime] Return the right mutable modes from INQUIRE in child I/O
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Wed Feb 15 08:00:54 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGef15617f124c: [flang][runtime] Return the right mutable modes from INQUIRE in child I/O (authored by klausler).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144046/new/
https://reviews.llvm.org/D144046
Files:
flang/runtime/io-stmt.cpp
Index: flang/runtime/io-stmt.cpp
===================================================================
--- flang/runtime/io-stmt.cpp
+++ flang/runtime/io-stmt.cpp
@@ -186,7 +186,12 @@
ExternalFileUnit &unit, const char *sourceFile, int sourceLine)
: IoStatementBase{sourceFile, sourceLine}, unit_{unit} {}
-MutableModes &ExternalIoStatementBase::mutableModes() { return unit_.modes; }
+MutableModes &ExternalIoStatementBase::mutableModes() {
+ if (const ChildIo * child{unit_.GetChildIo()}) {
+ return child->parent().mutableModes();
+ }
+ return unit_.modes;
+}
ConnectionState &ExternalIoStatementBase::GetConnectionState() { return unit_; }
@@ -981,8 +986,8 @@
case HashInquiryKeyword("BLANK"):
str = !unit().IsConnected() || unit().isUnformatted.value_or(true)
? "UNDEFINED"
- : unit().modes.editingFlags & blankZero ? "ZERO"
- : "NULL";
+ : mutableModes().editingFlags & blankZero ? "ZERO"
+ : "NULL";
break;
case HashInquiryKeyword("CARRIAGECONTROL"):
str = "LIST";
@@ -993,14 +998,14 @@
case HashInquiryKeyword("DECIMAL"):
str = !unit().IsConnected() || unit().isUnformatted.value_or(true)
? "UNDEFINED"
- : unit().modes.editingFlags & decimalComma ? "COMMA"
- : "POINT";
+ : mutableModes().editingFlags & decimalComma ? "COMMA"
+ : "POINT";
break;
case HashInquiryKeyword("DELIM"):
if (!unit().IsConnected() || unit().isUnformatted.value_or(true)) {
str = "UNDEFINED";
} else {
- switch (unit().modes.delim) {
+ switch (mutableModes().delim) {
case '\'':
str = "APOSTROPHE";
break;
@@ -1046,8 +1051,8 @@
case HashInquiryKeyword("PAD"):
str = !unit().IsConnected() || unit().isUnformatted.value_or(true)
? "UNDEFINED"
- : unit().modes.pad ? "YES"
- : "NO";
+ : mutableModes().pad ? "YES"
+ : "NO";
break;
case HashInquiryKeyword("POSITION"):
if (!unit().IsConnected() || unit().access == Access::Direct) {
@@ -1078,7 +1083,7 @@
if (!unit().IsConnected() || unit().isUnformatted.value_or(true)) {
str = "UNDEFINED";
} else {
- switch (unit().modes.round) {
+ switch (mutableModes().round) {
case decimal::FortranRounding::RoundNearest:
str = "NEAREST";
break;
@@ -1107,8 +1112,8 @@
case HashInquiryKeyword("SIGN"):
str = !unit().IsConnected() || unit().isUnformatted.value_or(true)
? "UNDEFINED"
- : unit().modes.editingFlags & signPlus ? "PLUS"
- : "SUPPRESS";
+ : mutableModes().editingFlags & signPlus ? "PLUS"
+ : "SUPPRESS";
break;
case HashInquiryKeyword("STREAM"):
str = !unit().IsConnected() ? "UNKNOWN"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144046.497681.patch
Type: text/x-patch
Size: 3070 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230215/17ccefc3/attachment.bin>
More information about the flang-commits
mailing list