summaryrefslogtreecommitdiffstats
path: root/llvm/include/llvm/Support/FileSystem.h
Commit message (Collapse)AuthorAgeFilesLines
* Use error_code() instead of error_code::succes()Rafael Espindola2014-05-311-1/+1
| | | | | | | There is no std::error_code::success, so this removes much of the noise in transitioning to std::error_code. llvm-svn: 209952
* delete dead code.Rafael Espindola2014-05-311-24/+0
| | | | llvm-svn: 209938
* raw_ostream: Forward declare OpenFlags and include FileSystem.h only where ↵Benjamin Kramer2014-04-291-1/+1
| | | | | | necessary. llvm-svn: 207593
* [Windows] Fix assertion failure when passing 'nul' in input to clang.Andrea Di Biagio2014-04-291-3/+18
| | | | | | | | | | | | | | | | | Before this patch, if 'nul' was passed in input to clang, function getStatus() (in Path.inc) always returned an instance of file_status with field 'nFileSizeHigh' and 'nFileSizeLow' left uninitialized. This was causing the triggering of an assertion failure in MemoryBuffer.cpp due to an invalid FileSize for device 'nul'. This patch fixes the assertion failure modifying the constructors of class file_status (in llvm/Support/FileSystem.h) so that every field of the class gets initialized to zero by default. A clang test will be submitted on a separate patch. llvm-svn: 207575
* [C++11] Replace some comparisons with 'nullptr' with simple boolean checks ↵Craig Topper2014-04-091-2/+2
| | | | | | to reduce verbosity. llvm-svn: 205829
* [C++11] Make use of 'nullptr' in the Support library.Craig Topper2014-04-071-3/+3
| | | | llvm-svn: 205697
* Remove dead and incorrect code.Rafael Espindola2014-03-201-17/+1
| | | | | | is_symlink was always false since it was using stat instead of lstat. llvm-svn: 204361
* support: add a utility function to normalise path separatorsSaleem Abdulrasool2014-03-111-0/+8
| | | | | | | | Add a utility function to convert the Windows path separator to Unix style path separators. This is used by a subsequent change in clang to enable the use of Windows SDK headers on Linux. llvm-svn: 203611
* Cleanup the interface for creating soft or hard links.Rafael Espindola2014-03-111-4/+9
| | | | | | | | | | | | Before this patch the unix code for creating hardlinks was unused. The code for creating symbolic links was implemented in lib/Support/LockFileManager.cpp and the code for creating hard links in lib/Support/*/Path.inc. The only use we have for these is in LockFileManager.cpp and it can use both soft and hard links. Just have a create_link function that creates one or the other depending on the platform. llvm-svn: 203596
* Revert create_symbolic_link and both depending changesReid Kleckner2014-03-061-8/+0
| | | | | | | | | | This reverts commits r203136, r203137, and r203138. This code doesn't build on Windows. Even on Vista+, Windows requires elevated privileges to create a symlink. Therefore we can't use symlinks in the compiler. We'll have to find another approach. llvm-svn: 203143
* [Support/FileSystem] Introduce llvm::sys::fs::create_symbolic_link().Argyrios Kyrtzidis2014-03-061-0/+8
| | | | llvm-svn: 203136
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-061-1/+0
| | | | | | | | | | This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
* Add missing include.Benjamin Kramer2014-03-031-0/+1
| | | | | | libstdc++ and libc++ pulled this in transitively so I didn't notice. llvm-svn: 202753
* [C++11] Use std::tie to simplify compare operators.Benjamin Kramer2014-03-031-2/+1
| | | | | | No functionality change. llvm-svn: 202751
* [C++11] Remove the R-value reference #if usage from the ADT and SupportChandler Carruth2014-03-011-2/+0
| | | | | | libraries. It is now always 1 in LLVM builds. llvm-svn: 202580
* Replace the F_Binary flag with a F_Text one.Rafael Espindola2014-02-241-3/+3
| | | | | | | | | After this I will set the default back to F_None. The advantage is that before this patch forgetting to set F_Binary would corrupt a file on windows. Forgetting to set F_Text produces one that cannot be read in notepad, which is a better failure mode :-) llvm-svn: 202052
* Share a createUniqueEntity implementation between unix and windows.Rafael Espindola2014-02-241-1/+4
| | | | | | | The only extra bit of functionality that had to be exposed for this be be implemented in Path.cpp is opening a file in rw mode. llvm-svn: 202005
* Simplify remove, create_directory and create_directories.Rafael Espindola2014-02-231-34/+12
| | | | | | | | | | | | | | | Before this patch they would take an boolean argument to say if the path already existed. This was redundant with the returned error_code which is able to represent that. This allowed for callers to incorrectly check only the existed flag instead of first checking the error code. Instead, pass in a boolean flag to say if the previous (non-)existence should be an error or not. Callers of the of the old simple versions are not affected. They still ignore the previous (non-)existence as they did before. llvm-svn: 201979
* Remove dead code.Rafael Espindola2014-02-131-8/+0
| | | | llvm-svn: 201327
* Finish bringing file_type to the llvm style (other than its name).Rafael Espindola2014-01-281-6/+5
| | | | | | | | | | I assume that the name is file_type because it is the name of a c++11 type that we will use once we convert, but at least our current implementation can look like llvm code. Thanks to David Blakie for the push. llvm-svn: 200354
* Convert to the inner enum so the compiler can warn about it in switches.Rafael Espindola2014-01-281-3/+2
| | | | llvm-svn: 200352
* Remove remove_all. A compiler has no need for recursively deleting a directory.Rafael Espindola2014-01-101-16/+0
| | | | llvm-svn: 198955
* Build fix for Android NDK which has neither futimes nor futimensAlp Toker2013-12-111-0/+5
| | | | | | Based on a patch by Neil Henning! llvm-svn: 197045
* Path: Recognize COFF import library file magic.Rui Ueyama2013-11-151-0/+1
| | | | | | | | | | | | Summary: Make identify_magic to recognize COFF import file. Reviewers: Bigcheese CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2165 llvm-svn: 194852
* Remove declared but not implemented function.Rafael Espindola2013-10-291-11/+0
| | | | llvm-svn: 193637
* Speling fixes.Benjamin Kramer2013-10-221-1/+1
| | | | llvm-svn: 193165
* Support/FileSystem.h: Remove a trailing comma in enum file_magic::Impl.NAKAMURA Takumi2013-10-151-1/+1
| | | | llvm-svn: 192745
* Path: Recognize Windows compiled resource file.Rui Ueyama2013-10-151-1/+2
| | | | | | | | | | | | | | Some background: One can pass compiled resource files (.res files) directly to the linker on Windows. If a resource file is given, the linker will run "cvtres" command in background to convert the resource file to a COFF file to link it. What I'm trying to do with this patch is to make the linker to recognize the resource file by file magic, so that it can run cvtres command. Differential Revision: http://llvm-reviews.chandlerc.com/D1943 llvm-svn: 192742
* Fix typos in assert message.Nick Lewycky2013-09-051-1/+1
| | | | llvm-svn: 190034
* Make directory iterator sentinels free.Benjamin Kramer2013-08-091-3/+9
| | | | | | | This trades some complexity in operator== for not introducing static objects into any functions using recursive directory iterators. llvm-svn: 188081
* Expose that the unique file ID has a device and a file component.Rafael Espindola2013-08-011-4/+10
| | | | | | | The use of sd_dev and st_ino has reached libclang, so expose the two components in UniqueID so that we can use it in clang. llvm-svn: 187616
* Make file_status::getUniqueID const.Rafael Espindola2013-07-291-1/+1
| | | | llvm-svn: 187383
* Include st_dev to make the result of getUniqueID actually unique.Rafael Espindola2013-07-291-3/+14
| | | | | | This will let us use getUniqueID instead of st_dev directly on clang. llvm-svn: 187378
* Remove dead code.Rafael Espindola2013-07-181-28/+0
| | | | llvm-svn: 186561
* Add simpler version of is_directory. It will be used in clang.Rafael Espindola2013-07-171-0/+7
| | | | llvm-svn: 186486
* Add a wrapper for open.Rafael Espindola2013-07-161-0/+31
| | | | | | | This centralizes the handling of O_BINARY and opens the way for hiding more differences (like how open behaves with directories). llvm-svn: 186447
* Add a version of sys::fs::status that uses fstat.Rafael Espindola2013-07-161-0/+3
| | | | llvm-svn: 186378
* Instead friending status, provide windows and posix constructors to file_status.Rafael Espindola2013-07-161-19/+34
| | | | | | | This opens the way of having static helpers in the .inc files that can construct a file_status. llvm-svn: 186376
* Update doxygen comment to match renamed parameters.Benjamin Kramer2013-07-101-2/+2
| | | | | | Found by -Wdocumentation. llvm-svn: 186021
* Use status to implement file_size.Rafael Espindola2013-07-101-1/+13
| | | | | | | | | | The status function is already using a syscall that returns the file size. Remember it and implement file_size as a simple wrapper. No functionally change, but clients that already use status now can avoid calling file_size. llvm-svn: 186016
* clang-format this enum.Rafael Espindola2013-07-081-21/+20
| | | | llvm-svn: 185835
* We now always create files with the correct permissions. Simplify the interface.Rafael Espindola2013-07-081-12/+1
| | | | llvm-svn: 185834
* Remove unique_file now that it is unused.Rafael Espindola2013-07-051-30/+0
| | | | llvm-svn: 185728
* Add a createUniqueFile function and switch llvm's users of unique_file.Rafael Espindola2013-07-051-0/+29
| | | | | | | | | | | | | | This function is complementary to createTemporaryFile. It handles the case were the unique file is *not* temporary: we will rename it in the end. Since we will rename it, the file has to be in the same filesystem as the final destination and we don't prepend the system temporary directory. This has a small semantic difference from unique_file: the default mode is 0666. This matches the behavior of most unix tools. For example, with this change lld now produces files with the same permissions as ld. I will add a test of this change when I port clang over to createUniqueFile (next commit). llvm-svn: 185726
* Add a higher level createTemporaryFile function.Rafael Espindola2013-07-051-0/+16
| | | | | | | | This function is inspired by clang's Driver::GetTemporaryPath. It hides the pattern used for uniquing and requires simple file names that are always placed in the system temporary directory. llvm-svn: 185716
* Don't ask for a mode when we are not keeping the file.Rafael Espindola2013-06-281-2/+1
| | | | llvm-svn: 185123
* Fix typoMatt Arsenault2013-06-281-1/+1
| | | | llvm-svn: 185120
* Add a convenience createUniqueDirectory function.Rafael Espindola2013-06-271-2/+7
| | | | | | | | | | | There are a few valid situation where we care about the structure inside a directory, but not about the directory itself. A simple example is for unit testing directory traversal. PathV1 had a function like this, add one to V2 and port existing users of the created temp file and delete it hack to using it. llvm-svn: 185059
* Use enums instead of raw octal values.Rafael Espindola2013-06-261-2/+7
| | | | | | Patch by 罗勇刚(Yonggang Luo). llvm-svn: 184971
* Add a convenience functions that don't return if the directory existed.Rafael Espindola2013-06-261-0/+14
| | | | llvm-svn: 184955
OpenPOWER on IntegriCloud