Skip to content

Commit b30fa1c

Browse files
committed
[flang] Add entry points for internal scalar list-directed I/O
BeginInternalListInput and BeginInternalListOutput were missing from the I/O API implementation; add them. Reviewed By: PeteSteinfeld Differential Revision: https://reviews.llvm.org/D84066
1 parent fda901a commit b30fa1c

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

flang/runtime/io-api.cpp

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,32 @@ Cookie IONAME(BeginInternalArrayFormattedInput)(const Descriptor &descriptor,
7373
formatLength, scratchArea, scratchBytes, sourceFile, sourceLine);
7474
}
7575

76+
template <Direction DIR>
77+
Cookie BeginInternalListIO(
78+
std::conditional_t<DIR == Direction::Input, const char, char> *internal,
79+
std::size_t internalLength, void ** /*scratchArea*/,
80+
std::size_t /*scratchBytes*/, const char *sourceFile, int sourceLine) {
81+
Terminator oom{sourceFile, sourceLine};
82+
return &New<InternalListIoStatementState<DIR>>{oom}(
83+
internal, internalLength, sourceFile, sourceLine)
84+
.release()
85+
->ioStatementState();
86+
}
87+
88+
Cookie IONAME(BeginInternalListOutput)(char *internal,
89+
std::size_t internalLength, void **scratchArea, std::size_t scratchBytes,
90+
const char *sourceFile, int sourceLine) {
91+
return BeginInternalListIO<Direction::Output>(internal, internalLength,
92+
scratchArea, scratchBytes, sourceFile, sourceLine);
93+
}
94+
95+
Cookie IONAME(BeginInternalListInput)(const char *internal,
96+
std::size_t internalLength, void **scratchArea, std::size_t scratchBytes,
97+
const char *sourceFile, int sourceLine) {
98+
return BeginInternalListIO<Direction::Input>(internal, internalLength,
99+
scratchArea, scratchBytes, sourceFile, sourceLine);
100+
}
101+
76102
template <Direction DIR>
77103
Cookie BeginInternalFormattedIO(
78104
std::conditional_t<DIR == Direction::Input, const char, char> *internal,
@@ -90,7 +116,6 @@ Cookie IONAME(BeginInternalFormattedOutput)(char *internal,
90116
std::size_t internalLength, const char *format, std::size_t formatLength,
91117
void **scratchArea, std::size_t scratchBytes, const char *sourceFile,
92118
int sourceLine) {
93-
Terminator oom{sourceFile, sourceLine};
94119
return BeginInternalFormattedIO<Direction::Output>(internal, internalLength,
95120
format, formatLength, scratchArea, scratchBytes, sourceFile, sourceLine);
96121
}
@@ -99,7 +124,6 @@ Cookie IONAME(BeginInternalFormattedInput)(const char *internal,
99124
std::size_t internalLength, const char *format, std::size_t formatLength,
100125
void **scratchArea, std::size_t scratchBytes, const char *sourceFile,
101126
int sourceLine) {
102-
Terminator oom{sourceFile, sourceLine};
103127
return BeginInternalFormattedIO<Direction::Input>(internal, internalLength,
104128
format, formatLength, scratchArea, scratchBytes, sourceFile, sourceLine);
105129
}

0 commit comments

Comments
 (0)