From 3cb84ef65dd417bc152fdaa173127966ca949318 Mon Sep 17 00:00:00 2001 From: "Michael J. Spencer" Date: Fri, 3 Dec 2010 01:21:28 +0000 Subject: Support/FileSystem: Add unique_file and exists implementations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120776 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/FileSystem.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'include/llvm/Support/FileSystem.h') diff --git a/include/llvm/Support/FileSystem.h b/include/llvm/Support/FileSystem.h index 960853569f..46bb3d68ba 100644 --- a/include/llvm/Support/FileSystem.h +++ b/include/llvm/Support/FileSystem.h @@ -390,19 +390,21 @@ error_code symlink_status(const Twine &path, file_status &result); /// /// Generates a unique path suitable for a temporary file and then opens it as a /// file. The name is based on \a model with '%' replaced by a random char in -/// [0-9a-f]. +/// [0-9a-f]. If \a model is not an absolute path, a suitable temporary +/// directory will be prepended. /// /// This is an atomic operation. Either the file is created and opened, or the /// file system is left untouched. /// -/// clang-%%-%%-%%-%%-%%.s => /clang-a0-b1-c2-d3-e4.s +/// clang-%%-%%-%%-%%-%%.s => /tmp/clang-a0-b1-c2-d3-e4.s /// /// @param model Name to base unique path off of. -/// @param result Set to the opened file. -/// @results errc::success if result has been successfully set, otherwise a -/// platform specific error_code. -/// @see temp_directory_path -error_code unique_file(const Twine &model, void* i_have_not_decided_the_ty_yet); +/// @param result_fs Set to the opened file's file descriptor. +/// @param result_path Set to the opened file's absolute path. +/// @results 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 &result_path); /// @brief Canonicalize path. /// -- cgit v1.2.3-70-g09d2