diff --git a/flang/runtime/io-api.cpp b/flang/runtime/io-api.cpp --- a/flang/runtime/io-api.cpp +++ b/flang/runtime/io-api.cpp @@ -73,6 +73,32 @@ formatLength, scratchArea, scratchBytes, sourceFile, sourceLine); } +template +Cookie BeginInternalListIO( + std::conditional_t *internal, + std::size_t internalLength, void ** /*scratchArea*/, + std::size_t /*scratchBytes*/, const char *sourceFile, int sourceLine) { + Terminator oom{sourceFile, sourceLine}; + return &New>{oom}( + internal, internalLength, sourceFile, sourceLine) + .release() + ->ioStatementState(); +} + +Cookie IONAME(BeginInternalListOutput)(char *internal, + std::size_t internalLength, void **scratchArea, std::size_t scratchBytes, + const char *sourceFile, int sourceLine) { + return BeginInternalListIO(internal, internalLength, + scratchArea, scratchBytes, sourceFile, sourceLine); +} + +Cookie IONAME(BeginInternalListInput)(const char *internal, + std::size_t internalLength, void **scratchArea, std::size_t scratchBytes, + const char *sourceFile, int sourceLine) { + return BeginInternalListIO(internal, internalLength, + scratchArea, scratchBytes, sourceFile, sourceLine); +} + template Cookie BeginInternalFormattedIO( std::conditional_t *internal, @@ -90,7 +116,6 @@ std::size_t internalLength, const char *format, std::size_t formatLength, void **scratchArea, std::size_t scratchBytes, const char *sourceFile, int sourceLine) { - Terminator oom{sourceFile, sourceLine}; return BeginInternalFormattedIO(internal, internalLength, format, formatLength, scratchArea, scratchBytes, sourceFile, sourceLine); } @@ -99,7 +124,6 @@ std::size_t internalLength, const char *format, std::size_t formatLength, void **scratchArea, std::size_t scratchBytes, const char *sourceFile, int sourceLine) { - Terminator oom{sourceFile, sourceLine}; return BeginInternalFormattedIO(internal, internalLength, format, formatLength, scratchArea, scratchBytes, sourceFile, sourceLine); }