Rafael Espindola
4d08d8bada
Use status to implement file_size.
...
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
2013-07-10 17:16:40 +00:00
Rafael Espindola
a8a9f1baf0
We now always create files with the correct permissions. Simplify the interface.
...
llvm-svn: 185834
2013-07-08 16:42:01 +00:00
Rafael Espindola
e79a87226a
Improvements to unique_file and createUniqueDirectory.
...
* Don't try to create parent directories in unique_file. It had two problem:
* It violates the contract that it is atomic. If the directory creation
success and the file creation fails, we would return an error but the
file system was modified.
* When creating a temporary file clang would have to first check if the
parent directory existed or not to avoid creating one when it was not
supposed to.
* More efficient implementations of createUniqueDirectory and the unique_file
that produces only the file name. Now all 3 just call into a static
function passing what they want (name, file or directory).
Clang also has to be updated, so tests might fail if a bot picks up this commit
and not the corresponding clang one.
llvm-svn: 185126
2013-06-28 03:48:47 +00:00
Rafael Espindola
f1fc3829a8
Rename PathV2 to just Path now that it is the only one.
...
llvm-svn: 185015
2013-06-26 19:33:03 +00:00
Rafael Espindola
b0f2eba499
PathV1 is deprecated since the 18th of Dec 2010. Remove it.
...
llvm-svn: 184960
2013-06-26 16:24:35 +00:00
Rafael Espindola
4b304b0abf
Remove sys::GetMainExecutable.
...
llvm-svn: 184916
2013-06-26 05:05:37 +00:00
Rafael Espindola
e03dfd9b0a
Port GetMainExecutable over to PathV2.
...
I will remove the V1 version as soon as I change clang in the next commit.
llvm-svn: 184914
2013-06-26 05:01:35 +00:00
Rafael Espindola
00efef2835
Remove PathWithStatus.
...
llvm-svn: 184910
2013-06-26 04:15:55 +00:00
Rafael Espindola
242fcb846e
Move GetEXESuffix to the one place it is used.
...
llvm-svn: 184853
2013-06-25 14:42:30 +00:00
Rafael Espindola
db7c03f05e
Remove sys::PathSeparator.
...
llvm-svn: 184852
2013-06-25 14:32:45 +00:00
Rafael Espindola
be3ede7958
make getLastModificationTime const. Move it with the other getters.
...
llvm-svn: 184478
2013-06-20 21:51:49 +00:00
Rafael Espindola
4a3365c869
Add a setLastModificationAndAccessTime to PathV2.
...
With this we can remove the last use of PathV1 from llvm-ar.cpp.
llvm-svn: 184464
2013-06-20 20:56:14 +00:00
Rafael Espindola
db5d8feeea
Add support for getting the last modification time from a file_status.
...
Use that in llvm-ar.cpp to replace a use of sys::PathWithStatus.
llvm-svn: 184450
2013-06-20 18:42:04 +00:00
Rafael Espindola
7cf7c51cc4
Rename fs::GetUniqueID to fs::getUniqueID to match the style guide.
...
llvm-svn: 184431
2013-06-20 15:06:35 +00:00
Aaron Ballman
9fbe530d74
Modified the implementation of fs::GetUniqueID on Windows such that it actually finds a unique identifier for a file. Also adds unit tests for GetUniqueID.
...
llvm-svn: 184351
2013-06-19 21:03:50 +00:00
Rafael Espindola
02d0ec8e70
Remove Path::getDirectoryContents.
...
llvm-svn: 184311
2013-06-19 15:32:37 +00:00
Rafael Espindola
988252dcd2
Remove Path::canExecute.
...
llvm-svn: 184298
2013-06-19 13:25:31 +00:00
Rafael Espindola
2bf893664b
Remove Path::canWrite.
...
llvm-svn: 184235
2013-06-18 21:10:03 +00:00
Rafael Espindola
a1280c16fb
Add a can_write function to PathV2.
...
llvm-svn: 184233
2013-06-18 20:56:38 +00:00
Rafael Espindola
3025f2366f
Remove unused Path::canRead.
...
llvm-svn: 184229
2013-06-18 20:42:25 +00:00
Rafael Espindola
8f181a5406
Remove uniqueID from PathV1.h.
...
llvm-svn: 184219
2013-06-18 19:46:19 +00:00
Rafael Espindola
45e6c2406d
Add a GetUniqueID that will replace the uniqueID of PathV1.h.
...
llvm-svn: 184217
2013-06-18 19:34:49 +00:00
Rafael Espindola
158d537c5a
Add GetCurrentDirectory back.
...
It looks like clang-tools-extra/unittests/cpp11-migrate/TransformTest.cpp
depends on the behaviour of the old one on Windows. Maybe a difference
between GetCurrentDirectoryA and GetCurrentDirectoryW?
llvm-svn: 184009
2013-06-14 21:41:33 +00:00
Rafael Espindola
ef03b9fc52
Replace use of PathV1.h in MCContext.cpp.
...
GetCurrentDirectory is now unused. Remove it.
llvm-svn: 184003
2013-06-14 20:26:58 +00:00
Rafael Espindola
b0a5c96379
Replace use of PathV1.h in Program.cpp.
...
llvm-svn: 183996
2013-06-14 19:38:45 +00:00
Rafael Espindola
f7c67014f3
Remove unused argument.
...
llvm-svn: 183992
2013-06-14 18:12:13 +00:00
Rafael Espindola
9aa3d5d7b2
Remove a use of sys::Path.
...
llvm-svn: 183979
2013-06-14 13:59:21 +00:00
Rafael Espindola
5f81f48bd4
Try to fix the windows build.
...
llvm-svn: 183950
2013-06-13 21:38:21 +00:00
Rafael Espindola
4f35da77a6
Don't use PathV1.h in Signals.h.
...
llvm-svn: 183947
2013-06-13 21:16:58 +00:00
Rafael Espindola
4c7ad8fc27
Have sys::FindProgramByName return a std::string.
...
llvm-svn: 183928
2013-06-13 19:25:37 +00:00
Reid Kleckner
6e6a0f50b3
[Support] Fix handle and memory leak for processes that are not waited for
...
Execute's Data parameter is now optional, so we won't allocate memory
for it on Windows and we'll close the process handle.
The Unix code should probably do something similar to avoid accumulation
of zombie children that haven't been waited on.
Tested on Linux and Windows.
llvm-svn: 183906
2013-06-13 15:27:17 +00:00
Rafael Espindola
0c24b20d33
[Win] Put ChangeStdinToBinary ChangeStdoutToBinary ChangeStderrToBinary in sys.
...
llvm-svn: 183868
2013-06-12 21:25:04 +00:00
Rafael Espindola
2bb2aa27bf
s/Void/void.
...
llvm-svn: 183866
2013-06-12 21:16:07 +00:00
Rafael Espindola
404ae77e38
Attempt at fixing the windows build.
...
llvm-svn: 183865
2013-06-12 21:11:50 +00:00
Rafael Espindola
b703be2544
Remove Path::getMagicNumber.
...
llvm-svn: 183839
2013-06-12 15:07:11 +00:00
Rafael Espindola
af93517dde
Remove Path::isAbsolute.
...
llvm-svn: 183836
2013-06-12 15:02:39 +00:00
Rafael Espindola
87b03450ee
Remove Path::isAbsolute().
...
llvm-svn: 183835
2013-06-12 14:47:33 +00:00
Rafael Espindola
46e2ea64cc
Remove Path::getSuffix.
...
llvm-svn: 183833
2013-06-12 14:32:51 +00:00
Rafael Espindola
ec4f0fc7c1
Remove sys::CopyFile.
...
llvm-svn: 183831
2013-06-12 14:16:52 +00:00
Rafael Espindola
d88308767b
Remove the old file memory mapping functions.
...
llvm-svn: 183828
2013-06-12 14:11:15 +00:00
Rafael Espindola
1d08f5ae7c
Remove Path::createFileOnDisk.
...
llvm-svn: 183827
2013-06-12 13:59:17 +00:00
Rafael Espindola
d5fd942ec3
Remove Path::makeExecutableOnDisk.
...
llvm-svn: 183826
2013-06-12 13:55:07 +00:00
Rafael Espindola
c656225b9d
Remove Path::getDirname.
...
llvm-svn: 183780
2013-06-11 19:32:57 +00:00
Rafael Espindola
4d725f66bd
Remove Path::getBasename.
...
llvm-svn: 183779
2013-06-11 19:29:48 +00:00
Rafael Espindola
7fc279aecb
Remove Path::getLast.
...
llvm-svn: 183778
2013-06-11 19:25:17 +00:00
Rafael Espindola
75f89f5225
Remove GetRootDirectory.
...
llvm-svn: 183775
2013-06-11 19:13:52 +00:00
Rafael Espindola
8b86c6c509
Remove GetUserHomeDirectory.
...
llvm-svn: 183773
2013-06-11 19:08:15 +00:00
Rafael Espindola
8cc6dc26bb
Remove GetSystemLibraryPaths.
...
llvm-svn: 183770
2013-06-11 18:58:47 +00:00
Rafael Espindola
b5f4a1b0ba
Remove Path::GetBitcodeLibraryPaths.
...
llvm-svn: 183765
2013-06-11 18:45:35 +00:00
Aaron Ballman
f0b5384ef9
sys::process::get_id() now returns the process ID instead of a process handle on Windows. Patch thanks to Kim Gräsman!
...
llvm-svn: 183621
2013-06-08 20:29:03 +00:00