Remove trailing spaces.
[oota-llvm.git] / include / llvm / Support / FileSystem.h
index 5d6020502dc68bc94ca90afdc17c41c3d7be7af3..ffa642787b0b6c0f09a3e3593d7284c997057fcd 100644 (file)
@@ -24,8 +24,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_SUPPORT_FILE_SYSTEM_H
-#define LLVM_SUPPORT_FILE_SYSTEM_H
+#ifndef LLVM_SUPPORT_FILESYSTEM_H
+#define LLVM_SUPPORT_FILESYSTEM_H
 
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/OwningPtr.h"
@@ -280,7 +280,7 @@ error_code create_symlink(const Twine &to, const Twine &from);
 /// @brief Get the current path.
 ///
 /// @param result Holds the current path on return.
-/// @results errc::success if the current path has been stored in result,
+/// @returns errc::success if the current path has been stored in result,
 ///          otherwise a platform specific error_code.
 error_code current_path(SmallVectorImpl<char> &result);
 
@@ -289,7 +289,7 @@ error_code current_path(SmallVectorImpl<char> &result);
 /// @param path Input path.
 /// @param existed Set to true if \a path existed, false if it did not.
 ///                undefined otherwise.
-/// @results errc::success if path has been removed and existed has been
+/// @returns errc::success if path has been removed and existed has been
 ///          successfully set, otherwise a platform specific error_code.
 error_code remove(const Twine &path, bool &existed);
 
@@ -298,7 +298,7 @@ error_code remove(const Twine &path, bool &existed);
 ///
 /// @param path Input path.
 /// @param num_removed Number of files removed.
-/// @results errc::success if path has been removed and num_removed has been
+/// @returns errc::success if path has been removed and num_removed has been
 ///          successfully set, otherwise a platform specific error_code.
 error_code remove_all(const Twine &path, uint32_t &num_removed);
 
@@ -323,7 +323,7 @@ error_code resize_file(const Twine &path, uint64_t size);
 /// @brief Does file exist?
 ///
 /// @param status A file_status previously returned from stat.
-/// @results True if the file represented by status exists, false if it does
+/// @returns True if the file represented by status exists, false if it does
 ///          not.
 bool exists(file_status status);
 
@@ -332,7 +332,7 @@ bool exists(file_status status);
 /// @param path Input path.
 /// @param result Set to true if the file represented by status exists, false if
 ///               it does not. Undefined otherwise.
-/// @results errc::success if result has been successfully set, otherwise a
+/// @returns errc::success if result has been successfully set, otherwise a
 ///          platform specific error_code.
 error_code exists(const Twine &path, bool &result);
 
@@ -350,7 +350,7 @@ inline bool exists(const Twine &path) {
 ///
 /// assert(status_known(A) || status_known(B));
 ///
-/// @results True if A and B both represent the same file system entity, false
+/// @returns True if A and B both represent the same file system entity, false
 ///          otherwise.
 bool equivalent(file_status A, file_status B);
 
@@ -362,7 +362,7 @@ bool equivalent(file_status A, file_status B);
 /// @param B Input path B.
 /// @param result Set to true if stat(A) and stat(B) have the same device and
 ///               inode (or equivalent).
-/// @results errc::success if result has been successfully set, otherwise a
+/// @returns errc::success if result has been successfully set, otherwise a
 ///          platform specific error_code.
 error_code equivalent(const Twine &A, const Twine &B, bool &result);
 
@@ -384,7 +384,7 @@ error_code file_size(const Twine &path, uint64_t &result);
 /// @brief Does status represent a directory?
 ///
 /// @param status A file_status previously returned from status.
-/// @results status.type() == file_type::directory_file.
+/// @returns status.type() == file_type::directory_file.
 bool is_directory(file_status status);
 
 /// @brief Is path a directory?
@@ -392,14 +392,14 @@ bool is_directory(file_status status);
 /// @param path Input path.
 /// @param result Set to true if \a path is a directory, false if it is not.
 ///               Undefined otherwise.
-/// @results errc::success if result has been successfully set, otherwise a
+/// @returns errc::success if result has been successfully set, otherwise a
 ///          platform specific error_code.
 error_code is_directory(const Twine &path, bool &result);
 
 /// @brief Does status represent a regular file?
 ///
 /// @param status A file_status previously returned from status.
-/// @results status_known(status) && status.type() == file_type::regular_file.
+/// @returns status_known(status) && status.type() == file_type::regular_file.
 bool is_regular_file(file_status status);
 
 /// @brief Is path a regular file?
@@ -407,7 +407,7 @@ bool is_regular_file(file_status status);
 /// @param path Input path.
 /// @param result Set to true if \a path is a regular file, false if it is not.
 ///               Undefined otherwise.
-/// @results errc::success if result has been successfully set, otherwise a
+/// @returns errc::success if result has been successfully set, otherwise a
 ///          platform specific error_code.
 error_code is_regular_file(const Twine &path, bool &result);
 
@@ -415,7 +415,7 @@ error_code is_regular_file(const Twine &path, bool &result);
 ///        directory, regular file, or symlink?
 ///
 /// @param status A file_status previously returned from status.
-/// @results exists(s) && !is_regular_file(s) && !is_directory(s) &&
+/// @returns exists(s) && !is_regular_file(s) && !is_directory(s) &&
 ///          !is_symlink(s)
 bool is_other(file_status status);
 
@@ -425,7 +425,7 @@ bool is_other(file_status status);
 /// @param path Input path.
 /// @param result Set to true if \a path exists, but is not a directory, regular
 ///               file, or a symlink, false if it does not. Undefined otherwise.
-/// @results errc::success if result has been successfully set, otherwise a
+/// @returns errc::success if result has been successfully set, otherwise a
 ///          platform specific error_code.
 error_code is_other(const Twine &path, bool &result);
 
@@ -440,7 +440,7 @@ bool is_symlink(file_status status);
 /// @param path Input path.
 /// @param result Set to true if \a path is a symlink, false if it is not.
 ///               Undefined otherwise.
-/// @results errc::success if result has been successfully set, otherwise a
+/// @returns errc::success if result has been successfully set, otherwise a
 ///          platform specific error_code.
 error_code is_symlink(const Twine &path, bool &result);
 
@@ -448,28 +448,28 @@ error_code is_symlink(const Twine &path, bool &result);
 ///
 /// @param path Input path.
 /// @param result Set to the file status.
-/// @results errc::success if result has been successfully set, otherwise a
+/// @returns errc::success if result has been successfully set, otherwise a
 ///          platform specific error_code.
 error_code status(const Twine &path, file_status &result);
 
 /// @brief Modifies permission bits on a file
 ///
 /// @param path Input path.
-/// @results errc::success if permissions have been changed, otherwise a
+/// @returns errc::success if permissions have been changed, otherwise a
 ///          platform specific error_code.
 error_code permissions(const Twine &path, perms prms);
 
 /// @brief Is status available?
 ///
 /// @param s Input file status.
-/// @results True if status() != status_error.
+/// @returns True if status() != status_error.
 bool status_known(file_status s);
 
 /// @brief Is status available?
 ///
 /// @param path Input path.
 /// @param result Set to true if status() != status_error.
-/// @results errc::success if result has been successfully set, otherwise a
+/// @returns errc::success if result has been successfully set, otherwise a
 ///          platform specific error_code.
 error_code status_known(const Twine &path, bool &result);
 
@@ -488,9 +488,9 @@ error_code status_known(const Twine &path, bool &result);
 /// @param model Name to base unique path off of.
 /// @param result_fd Set to the opened file's file descriptor.
 /// @param result_path Set to the opened file's absolute path.
-/// @param makeAbsolute If true and @model is not an absolute path, a temp
+/// @param makeAbsolute If true and \a model is not an absolute path, a temp
 ///        directory will be prepended.
-/// @results errc::success if result_{fd,path} have been successfully set,
+/// @returns errc::success if result_{fd,path} have been successfully set,
 ///          otherwise a platform specific error_code.
 error_code unique_file(const Twine &model, int &result_fd,
                        SmallVectorImpl<char> &result_path,
@@ -503,7 +503,7 @@ error_code unique_file(const Twine &model, int &result_fd,
 ///
 /// @param path Input path.
 /// @param result Set to the canonicalized version of \a path.
-/// @results errc::success if result has been successfully set, otherwise a
+/// @returns errc::success if result has been successfully set, otherwise a
 ///          platform specific error_code.
 error_code canonicalize(const Twine &path, SmallVectorImpl<char> &result);
 
@@ -511,7 +511,7 @@ error_code canonicalize(const Twine &path, SmallVectorImpl<char> &result);
 ///
 /// @param path Input path.
 /// @param magic Byte sequence to compare \a path's first len(magic) bytes to.
-/// @results errc::success if result has been successfully set, otherwise a
+/// @returns errc::success if result has been successfully set, otherwise a
 ///          platform specific error_code.
 error_code has_magic(const Twine &path, const Twine &magic, bool &result);
 
@@ -522,7 +522,7 @@ error_code has_magic(const Twine &path, const Twine &magic, bool &result);
 /// @param result Set to the first \a len bytes in the file pointed to by
 ///               \a path. Or the entire file if file_size(path) < len, in which
 ///               case result.size() returns the size of the file.
-/// @results errc::success if result has been successfully set,
+/// @returns errc::success if result has been successfully set,
 ///          errc::value_too_large if len is larger then the file pointed to by
 ///          \a path, otherwise a platform specific error_code.
 error_code get_magic(const Twine &path, uint32_t len,
@@ -535,14 +535,14 @@ file_magic identify_magic(StringRef magic);
 ///
 /// @param path Input path.
 /// @param result Set to the type of file, or LLVMFileType::Unknown_FileType.
-/// @results errc::success if result has been successfully set, otherwise a
+/// @returns errc::success if result has been successfully set, otherwise a
 ///          platform specific error_code.
 error_code identify_magic(const Twine &path, file_magic &result);
 
 /// @brief Get library paths the system linker uses.
 ///
 /// @param result Set to the list of system library paths.
-/// @results errc::success if result has been successfully set, otherwise a
+/// @returns errc::success if result has been successfully set, otherwise a
 ///          platform specific error_code.
 error_code GetSystemLibraryPaths(SmallVectorImpl<std::string> &result);
 
@@ -550,7 +550,7 @@ error_code GetSystemLibraryPaths(SmallVectorImpl<std::string> &result);
 ///        + LLVM_LIB_SEARCH_PATH + LLVM_LIBDIR.
 ///
 /// @param result Set to the list of bitcode library paths.
-/// @results errc::success if result has been successfully set, otherwise a
+/// @returns errc::success if result has been successfully set, otherwise a
 ///          platform specific error_code.
 error_code GetBitcodeLibraryPaths(SmallVectorImpl<std::string> &result);
 
@@ -563,7 +563,7 @@ error_code GetBitcodeLibraryPaths(SmallVectorImpl<std::string> &result);
 ///
 /// @param short_name Library name one would give to the system linker.
 /// @param result Set to the absolute path \a short_name represents.
-/// @results errc::success if result has been successfully set, otherwise a
+/// @returns errc::success if result has been successfully set, otherwise a
 ///          platform specific error_code.
 error_code FindLibrary(const Twine &short_name, SmallVectorImpl<char> &result);
 
@@ -572,7 +572,7 @@ error_code FindLibrary(const Twine &short_name, SmallVectorImpl<char> &result);
 /// @param argv0 The program name as it was spelled on the command line.
 /// @param MainAddr Address of some symbol in the executable (not in a library).
 /// @param result Set to the absolute path of the current executable.
-/// @results errc::success if result has been successfully set, otherwise a
+/// @returns errc::success if result has been successfully set, otherwise a
 ///          platform specific error_code.
 error_code GetMainExecutable(const char *argv0, void *MainAddr,
                              SmallVectorImpl<char> &result);
@@ -602,12 +602,12 @@ private:
   void *FileMappingHandle;
 #endif
 
-  error_code init(int FD, uint64_t Offset);
+  error_code init(int FD, bool CloseFD, uint64_t Offset);
 
 public:
   typedef char char_type;
 
-#if LLVM_USE_RVALUE_REFERENCES
+#if LLVM_HAS_RVALUE_REFERENCES
   mapped_file_region(mapped_file_region&&);
   mapped_file_region &operator =(mapped_file_region&&);
 #endif
@@ -633,8 +633,10 @@ public:
                      error_code &ec);
 
   /// \param fd An open file descriptor to map. mapped_file_region takes
-  ///           ownership. It must have been opended in the correct mode.
+  ///   ownership if closefd is true. It must have been opended in the correct
+  ///   mode.
   mapped_file_region(int fd,
+                     bool closefd,
                      mapmode mode,
                      uint64_t length,
                      uint64_t offset,
@@ -664,7 +666,7 @@ public:
 ///        to the file.  If false, the file will be mapped read-only
 ///        and the buffer will be read-only.
 /// @param result Set to the start address of the mapped buffer.
-/// @results errc::success if result has been successfully set, otherwise a
+/// @returns errc::success if result has been successfully set, otherwise a
 ///          platform specific error_code.
 error_code map_file_pages(const Twine &path, off_t file_offset, size_t size,  
                           bool map_writable, void *&result);
@@ -674,7 +676,7 @@ error_code map_file_pages(const Twine &path, off_t file_offset, size_t size,
 ///
 /// @param base Pointer to the start of the buffer.
 /// @param size Byte length of the range to unmmap.
-/// @results errc::success if result has been successfully set, otherwise a
+/// @returns errc::success if result has been successfully set, otherwise a
 ///          platform specific error_code.
 error_code unmap_file_pages(void *base, size_t size);