[flang-commits] [llvm] [lld] [flang] [libcxx] [clang] [libc++][streams] P1759R6: Native handles and file streams (PR #76632)

Mark de Wever via flang-commits flang-commits at lists.llvm.org
Tue Jan 2 09:11:49 PST 2024


================
@@ -245,6 +267,18 @@ public:
 #  endif
   _LIBCPP_HIDE_FROM_ABI basic_filebuf* __open(int __fd, ios_base::openmode __mode);
   basic_filebuf* close();
+#  if _LIBCPP_STD_VER >= 26
+  _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept {
+    _LIBCPP_ASSERT_UNCATEGORIZED(this->is_open(), "File must be opened");
+#    if defined(_LIBCPP_WIN32API)
+    return __filebuf_windows_native_handle(__file_);
+#    elif __has_include(<unistd.h>)
+    return fileno(__file_);
+#    else
+#      error "Provide a way to determine the file native handle!"
+#    endif
+  }
+#  endif
----------------
mordante wrote:

```suggestion
#  endif //  _LIBCPP_STD_VER >= 26
```

https://github.com/llvm/llvm-project/pull/76632


More information about the flang-commits mailing list