[PATCH] D46499: [Support] Add docs for 'openFileFor{Write,Read}'

Brian Gesiak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 5 21:11:34 PDT 2018


modocache created this revision.
modocache added reviewers: zturner, rnk.

Add documentation for the LLVM Support functions `openFileForWrite` and
`openFileForRead`. The `openFileForRead` parameter `RealPath`, in
particular, I think warranted some explanation.

Test Plan:

1. `ninja check-llvm`
2. `ninja docs-llvm-html`


Repository:
  rL LLVM

https://reviews.llvm.org/D46499

Files:
  include/llvm/Support/FileSystem.h


Index: include/llvm/Support/FileSystem.h
===================================================================
--- include/llvm/Support/FileSystem.h
+++ include/llvm/Support/FileSystem.h
@@ -816,9 +816,30 @@
   return A;
 }
 
+/// @brief Opens the file with the given name in a write-only or read-write
+/// mode, returning its open file descriptor. If the file does not exist, it
+/// is created.
+///
+/// @param Name The name of the file to open.
+/// @param ResultFD The location to store the descriptor for the opened file.
+/// @param Flags Additional flags used to determine whether the file should be
+///              opened in, for example, read-write or in write-only mode.
+/// @param Mode The access permissions of the file, represented in octal.
+/// @returns errc::success if \a Name has been opened, otherwise a
+///          platform-specific error_code.
 std::error_code openFileForWrite(const Twine &Name, int &ResultFD,
                                  OpenFlags Flags, unsigned Mode = 0666);
 
+/// @brief Opens the file with the given name in a read-only mode, returning
+/// its open file descriptor.
+///
+/// @param Name The name of the file to open.
+/// @param ResultFD The location to store the descriptor for the opened file.
+/// @param RealPath If nonnull, extra work is done to determine the real path
+///                 of the opened file, and that path is stored in this
+///                 location.
+/// @returns errc::success if \a Name has been opened, otherwise a
+///          platform-specific error_code.
 std::error_code openFileForRead(const Twine &Name, int &ResultFD,
                                 SmallVectorImpl<char> *RealPath = nullptr);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46499.145391.patch
Type: text/x-patch
Size: 1695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180506/c20bbd2c/attachment.bin>


More information about the llvm-commits mailing list