[libc-commits] [PATCH] D119458: [libc] Add a platform independent buffered file IO data structure.
Michael Jones via Phabricator via libc-commits
libc-commits at lists.llvm.org
Fri Feb 11 12:00:20 PST 2022
michaelrj added inline comments.
================
Comment at: libc/src/__support/File/file.h:67
+
+ // If own_buf is true, the |buf| is ownded by the stream and will be
+ // free-ed when close method is called on the stream.
----------------
ownded -> owned
================
Comment at: libc/src/__support/File/file.h:88-89
+ bool write_allowed() const {
+ return (mode & static_cast<ModeFlags>(OpenMode::WRITE)) ||
+ (mode & static_cast<ModeFlags>(OpenMode::APPEND));
+ }
----------------
I think
```
(mode & (static_cast<ModeFlags>(OpenMode::WRITE) | static_cast<ModeFlags>(OpenMode::APPEND)));
```
is clearer.
================
Comment at: libc/test/src/__support/File/CMakeLists.txt:1
+add_libc_unittest(
+ file_test
----------------
this needs to be conditioned on malloc being available, which currently means `if(LLVM_LIBC_INCLUDE_SCUDO OR NOT LLVM_LIBC_FULL_BUILD)`. I will go look into making a single variable that can encompass that in a cleanup patch.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119458/new/
https://reviews.llvm.org/D119458
More information about the libc-commits
mailing list