summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/Path.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Support] remove_dots: Remove windows test.Benjamin Kramer2016-10-171-2/+0
| | | | | | | Windows doesn't have roots, so I think this test doesn't make sense there. llvm-svn: 284386
* [Support] remove_dots: Remove .. from absolute paths.Benjamin Kramer2016-10-171-0/+4
| | | | | | | /../foo is still a proper path after removing the dotdot. This should now finally match https://9p.io/sys/doc/lexnames.html [Cleaning names]. llvm-svn: 284384
* unittests: Explicitly ignore some return values in crash testsJustin Bogner2016-10-161-16/+18
| | | | | | | | Ideally these would actually check that the results are reasonable, but given that we're looping over so many different kinds of path that isn't really practical. llvm-svn: 284350
* Do not delete leading ../ in remove_dots.Eric Liu2016-10-131-0/+4
| | | | | | | | | | Reviewers: bkramer Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25561 llvm-svn: 284129
* Fix a real temp file leak in FileOutputBufferReid Kleckner2016-09-021-0/+2
| | | | | | | | | | | | | If we failed to commit the buffer but did not die to a signal, the temp file would remain on disk on Windows. Having an open file mapping and file handle prevents the file from being deleted. I am choosing not to add an assertion of success on the temp file removal, since virus scanners and other environmental things can often cause removal to fail in real world tools. Also fix more temp file leaks in unit tests. llvm-svn: 280445
* Try to fix some temp file leaks in SupportTests, PR18335Reid Kleckner2016-09-021-13/+27
| | | | llvm-svn: 280443
* Use the range variant of find instead of unpacking begin/endDavid Majnemer2016-08-111-10/+10
| | | | | | | | | If the result of the find is only used to compare against end(), just use is_contained instead. No functionality change is intended. llvm-svn: 278433
* Switch to using an API that handles non-ASCII paths appropriately on Windows.Aaron Ballman2016-06-211-0/+26
| | | | llvm-svn: 273262
* Fix a relatively nasty bug with fs::getPathFromOpenFD() on Windows. The ↵Aaron Ballman2016-06-201-0/+33
| | | | | | GetFinalPathNameByHandle API does not behave as documented; if given a buffer that has enough space for the path but not the null terminator, the call will return the number of characters required *without* the null terminator (despite being documented otherwise) and it will not set GetLastError(). The result was that this function would return a bogus path and no error. Instead, ensure there is sufficient space for a null terminator (we already strip it off manually for compatibility with older versions of Windows). llvm-svn: 273195
* In openFileForRead, attempt to fetch the actual name of the file on disk -- ↵Taewook Oh2016-06-131-0/+57
| | | | | | | | | | | | | including case -- so that clang can later warn about non-portable #include and #import directives. Differential Revision: http://reviews.llvm.org/D19842 Corresponding clang patch: http://reviews.llvm.org/D19843 Re-commit after addressing issues with of generating too many warnings for Windows and asan test failures Patch by Eric Niebler llvm-svn: 272555
* Revert commit r271704, a patch that enables warnings for non-portable ↵Taewook Oh2016-06-041-57/+0
| | | | | | #include and #import paths (Corresponding clang patch has been reverted by r271761). Patches are reverted because they generate lots of unadressable warnings for windows and fail tests under ASAN. llvm-svn: 271764
* In openFileForRead, attempt to fetch the actual name of the file on disk -- ↵Taewook Oh2016-06-031-0/+57
| | | | | | | | | | including case -- so that clang can later warn about non-portable #include and #import directives. Differential Revision: http://reviews.llvm.org/D19842 Patch by Eric Niebler llvm-svn: 271704
* [ThinLTO] Option to control path of distributed backend filesTeresa Johnson2016-05-171-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add support to control where files for a distributed backend (the individual index files and optional imports files) are created. This is invoked with a new thinlto-prefix-replace option in the gold plugin and llvm-lto. If specified, expects a string of the form "oldprefix:newprefix", and instead of generating these files in the same directory path as the corresponding bitcode file, will use a path formed by replacing the bitcode file's path prefix matching oldprefix with newprefix. Also add a new replace_path_prefix helper to Path.h in libSupport. Depends on D19636. Reviewers: joker.eph Subscribers: llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D19644 llvm-svn: 269771
* [Support][Unittests] Add unittest for recursive_directory_iterator::level()Bruno Cardoso Lopes2016-05-131-0/+14
| | | | llvm-svn: 269488
* Unbreak building unit tests on Windows after r266595.Nico Weber2016-04-181-0/+1
| | | | llvm-svn: 266614
* [Support] Fix an invalid character escaping in string literal (unittest).Etienne Bergeron2016-04-051-1/+1
| | | | | | | | | | | | | | | | | | Summary: A character within a string literal is not escaped correctly. In this case, there is no semantic change because the invalid character turn out to be NUL anyway. note: "\0x12" is equivalent to {0, 'x', '1', '2'} and not { 12 }. This issue was found by clang-tidy. Reviewers: rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18747 llvm-svn: 265376
* Fix a -Wsign-compare in Support Path unittestsReid Kleckner2016-02-101-1/+1
| | | | llvm-svn: 260418
* Fix identify_magic() to check that a file that starts with MH_MAGIC isKevin Enderby2016-01-261-11/+19
| | | | | | | | | | | | at least as big as the mach header to be identified as a Mach-O file and make sure smaller files are not identified as a Mach-O files but as unknown files. Also fix identify_magic() so it looks at all 4 bytes of the filetype field when determining the type of the Mach-O file. Then fix the macho-invalid-header test case to check that it is an unknown file and make sure it does not get the error for object_error::parse_failed. And also update the unit tests. llvm-svn: 258883
* Fix -Wunused-function in a non-Win32 buildDavid Blaikie2015-11-171-1/+1
| | | | llvm-svn: 253373
* [Support] Tweak path::system_temp_directory() on Windows.Pawel Bylica2015-11-171-0/+70
| | | | | | | | | | | | | | | | | Summary: This patch changes the behavior of path::system_temp_directory() on Windows to be closer to GetTempPath Windows API call. Enforces path separator to be the native one, makes path absolute, etc. GetTempPath is not used directly because of limitations/implementation bugs on Windows 7. Windows specific unit tests are added. Most of them runs in separated process with modified environment variables. This change fixes FileSystemTest.CreateDir unittest that had been failing when run from Unix-like shell on Windows (Unix-like path separator (/) used in env variables). Reviewers: chapuni, rafael, aaron.ballman Subscribers: rafael, llvm-commits Differential Revision: http://reviews.llvm.org/D14231 llvm-svn: 253345
* Windows-specific test for sys::path::remove_dots.Mike Aizatsky2015-11-091-0/+13
| | | | | | Differential Revision: http://reviews.llvm.org/D14503 llvm-svn: 252504
* Moving FileManager::removeDotPaths to llvm::sys::path::remove_dotsMike Aizatsky2015-11-091-0/+20
| | | | | | Differential Revision: http://reviews.llvm.org/D14393 llvm-svn: 252499
* Revert r252366: [Support] Use GetTempDir to get the temporary dir path on ↵Pawel Bylica2015-11-061-70/+0
| | | | | | Windows. llvm-svn: 252367
* [Support] Use GetTempDir to get the temporary dir path on Windows.Pawel Bylica2015-11-061-0/+70
| | | | | | | | | | | | | | | Summary: In general GetTempDir follows the same logic as the replaced code: checks env variables TMP, TEMP, USERPROFILE in order. However, it also perform other checks like making separators native (\), making the path absolute, etc. This change fixes FileSystemTest.CreateDir unittest that had been failing when run from Unix-like shell on Windows (Unix-like path separator (/) used in env variables). Reviewers: chapuni, rafael, aaron.ballman Subscribers: rafael, llvm-commits Differential Revision: http://reviews.llvm.org/D14231 llvm-svn: 252366
* [Support] Extend sys::path with user_cache_directory function.Pawel Bylica2015-11-021-0/+29
| | | | | | | | | | | | | | | | | | | | Summary: The new function sys::path::user_cache_directory tries to discover a directory suitable for cache storage for current system user. On Windows and Darwin it returns a path to system-specific user cache directory. On Linux it follows XDG Base Directory Specification, what is: - use non-empty $XDG_CACHE_HOME env var, - use $HOME/.cache. Reviewers: chapuni, aaron.ballman, rafael Subscribers: rafael, aaron.ballman, llvm-commits Differential Revision: http://reviews.llvm.org/D13801 llvm-svn: 251784
* Fix path::home_directory() unit test.Pawel Bylica2015-10-161-8/+12
| | | | | | It turns out that constructing std::string from null pointer is not the very best idea. llvm-svn: 250506
* SupportTests::HomeDirectory: Don't try tests when $HOME is undefined.NAKAMURA Takumi2015-10-161-6/+9
| | | | | | Lit sanitizes env vars. $HOME is not exported in Lit tests. llvm-svn: 250505
* Reformat.NAKAMURA Takumi2015-10-161-1/+1
| | | | llvm-svn: 250504
* Use Windows Vista API to get the user's home directoryPawel Bylica2015-10-161-9/+13
| | | | | | | | | | | | Summary: This patch replaces usage of deprecated SHGetFolderPathW with SHGetKnownFolderPath. The usage of SHGetKnownFolderPath is wrapped to allow queries for other "known" folders in the near future. Reviewers: aaron.ballman, gbedwell Subscribers: chapuni, llvm-commits Differential Revision: http://reviews.llvm.org/D13753 llvm-svn: 250501
* Make test resilient against windows path separators.Benjamin Kramer2015-10-051-0/+1
| | | | llvm-svn: 249320
* [Support] Add a version of fs::make_absolute with a custom CWD.Benjamin Kramer2015-10-051-0/+4
| | | | | | This will be used soon from clang. llvm-svn: 249309
* [ADT] Switch a bunch of places in LLVM that were doing single-characterChandler Carruth2015-09-101-4/+4
| | | | | | | splits to actually use the single character split routine which does less work, and in a debug build is *substantially* faster. llvm-svn: 247245
* Move twice-repeated clang path operation into a new function.Douglas Katzman2015-09-021-0/+10
| | | | | | And make it more robust in the edge case of exactly "./" as input. llvm-svn: 246711
* Thread premissions through sys::fs::create_director{y|ies}Frederic Riss2015-08-061-0/+24
| | | | llvm-svn: 244268
* llvm/unittests/Support/Path.cpp: Use <windows.h> instead of <Windows.h>.NAKAMURA Takumi2015-06-161-1/+1
| | | | llvm-svn: 239804
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-111-4/+2
| | | | | | | | | | | | | | The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' \ -j=32 -fix -format http://reviews.llvm.org/D8925 llvm-svn: 234679
* Don't treat .foo as two path components in path::iteratorsBen Langmuir2015-03-101-0/+43
| | | | | | | We were treating '/.foo' as ['/', '.', 'foo'] instead of ['/', '.foo'], which lead to insanity. Same for '..'. llvm-svn: 231727
* Object: Handle Mach-O kext bundle filesJustin Bogner2015-02-251-0/+2
| | | | | | This particular subtype of Mach-O was missing. Add it. llvm-svn: 230567
* Move the resize file feature from mapped_file_region to the only user.Rafael Espindola2014-12-121-3/+6
| | | | | | This removes a duplicated stat on every file that llvm-ar looks at. llvm-svn: 224138
* Pass a FD to resise_file and add a testcase.Rafael Espindola2014-12-121-0/+10
| | | | | | I will add a real use in another commit. llvm-svn: 224136
* Remove a convoluted way of calling close by moving the call to the only caller.Rafael Espindola2014-12-111-12/+3
| | | | | | As a bonus we can actually check the return value. llvm-svn: 224046
* Remove dead code. NFC.Rafael Espindola2014-12-111-10/+7
| | | | llvm-svn: 224029
* Fixing some sign comparison warnings from MSVC; NFC.Aaron Ballman2014-11-131-3/+3
| | | | llvm-svn: 221887
* Drop a few unneeded ctor calls (missed code review comment).Paul Robinson2014-11-131-4/+4
| | | | llvm-svn: 221845
* Improve long path name support on Windows.Paul Robinson2014-11-131-2/+59
| | | | | | | | | | Windows normally limits the length of an absolute path name to 260 characters; directories can have lower limits. These limits increase to about 32K if you use absolute paths with the special '\\?\' prefix. Teach Support\Windows\Path.inc to use that prefix as needed. TODO: Other parts of Support could also learn to use this prefix. llvm-svn: 221841
* Fix identify_magic() with mach-o stub dylibs.Nick Kledzik2014-09-171-0/+3
| | | | | | The wrong value was returned and the unittest did not cover the stub dylib case. llvm-svn: 217933
* Support: Use llvm::COFF::BigObjMagicRui Ueyama2014-09-111-1/+1
| | | | | | | Use llvm::COFF::BigObjMagic insetad of the string literal. Also checks the version number. llvm-svn: 217633
* Support: improve identify_magic to recognize COFF bigobjRui Ueyama2014-09-111-0/+3
| | | | | | | identify_magic recognized a COFF bigobj as an import library file. This patch fixes that. llvm-svn: 217627
* Misc cleanups to the FileSytem api.Rafael Espindola2014-09-111-5/+4
| | | | | | | | | | | | | | | | The main difference is the removal of std::error_code exists(const Twine &path, bool &result); It was an horribly redundant interface since a file not existing is also a valid error_code. Now we have an access function that returns just an error_code. This is the only function that has to be implemented for Unix and Windows. The functions can_write, exists and can_execute an now just wrappers. One still has to be very careful using these function to avoid introducing race conditions (Time of check to time of use). llvm-svn: 217625
* Use simpler version of sys::fs::exists. NFC.Rafael Espindola2014-09-111-3/+2
| | | | llvm-svn: 217618
OpenPOWER on IntegriCloud