================
@@ -41,6 +52,26 @@ InternalDescriptorUnit<DIR>::InternalDescriptorUnit(
   endfileRecordNumber = d.Elements() + 1;
 }
 
+template <Direction DIR> void InternalDescriptorUnit<DIR>::EndIoStatement() {
+  if constexpr (DIR == Direction::Output) {
+    if (usesOwnBuffer) {
+      // Null terminate the buffer that contains just a single record.
+      Terminator terminator{__FILE__, __LINE__};
+      RUNTIME_CHECK(terminator,
+          furthestPositionInRecord <
+              static_cast<std::int64_t>(ownBufferSizeInBytes));
+      *reinterpret_cast<char *>(CurrentRecord() + furthestPositionInRecord) =
+          '\0';
+
+      // Print the buffer and deallocate memory.
+      // FIXME: this output does not match the regular unit 5 output.
+      std::printf("%s\n", descriptor().OffsetElement());
+      FreeMemory(descriptor().OffsetElement());
----------------
klausler wrote:

Why not `descriptor().Deallocate()` (and `descriptor().Allocate()`)?

https://github.com/llvm/llvm-project/pull/85181
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to