summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/VirtualFileSystemTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [VFS] Disable check for ../foo on WindowsJonas Devlieghere2019-12-111-0/+2
| | | | | I'm not sure how .. is resolved on Windows. Disable it for now to make the bots happy again.
* [VFS] Extend virtual working directory testJonas Devlieghere2019-12-111-0/+25
| | | | | Extend the virtual working directory test with a few edge cases that are not currently tested.
* Fix an unused variable introduced in rL374955 / rG21703543.David L. Jones2019-10-161-0/+1
| | | | | | Even though this is a unit test, it still may be run under optimization. llvm-svn: 374961
* [Reland][VirtualFileSystem] Support virtual working directory in the ↵Jonas Devlieghere2019-10-151-4/+171
| | | | | | | | | | | | | | | | | | | | RedirectingFS Before this patch, changing the working directory of the RedirectingFS would just forward to its external file system. This prevented us from having a working directory that only existed in the VFS mapping. This patch adds support for a virtual working directory in the RedirectingFileSystem. It now keeps track of its own WD in addition to updating the WD of the external file system. This ensures that we can still fall through for relative paths. This change was originally motivated by the reproducer infrastructure in LLDB where we want to deal transparently with relative paths. Differential revision: https://reviews.llvm.org/D65677 llvm-svn: 374955
* Revert "[VirtualFileSystem] Support virtual working directory in the ↵Jonas Devlieghere2019-10-151-171/+4
| | | | | | | | | | | RedirectingFS" This reverts the original commit and the follow up: Revert "[VirtualFileSystem] Support virtual working directory in the RedirectingFS" Revert "[test] Update YAML mapping in VirtualFileSystemTest" llvm-svn: 374935
* [test] Update YAML mapping in VirtualFileSystemTestJonas Devlieghere2019-10-151-6/+6
| | | | | | | The 'bar' directory should be part of the root rather than the file itself. llvm-svn: 374930
* [VirtualFileSystem] Support virtual working directory in the RedirectingFSJonas Devlieghere2019-10-151-4/+171
| | | | | | | | | | | | | | | | | | Before this patch, changing the working directory of the RedirectingFS would just forward to its external file system. This prevented us from having a working directory that only existed in the VFS mapping. This patch adds support for a virtual working directory in the RedirectingFileSystem. It now keeps track of its own WD in addition to updating the WD of the external file system. This ensures that we can still fall through for relative paths. This change was originally motivated by the reproducer infrastructure in LLDB where we want to deal transparently with relative paths. Differential revision: https://reviews.llvm.org/D65677 llvm-svn: 374917
* [VFS] Add reverse iterator to OverlayFileSystemJonas Devlieghere2019-07-031-0/+51
| | | | | | | | | | Add a reverse iterator to the overlay file system. This makes it possible to take overlays from one OverlayFileSystem, and add them to another. Differential revision: https://reviews.llvm.org/D64113 llvm-svn: 364986
* [X86] Use PC-relative mode for the kernel code modelBill Wendling2019-04-131-1/+2
| | | | | | | | | | | | | | | | | | Summary: The Linux kernel uses PC-relative mode, so allow that when the code model is "kernel". Reviewers: craig.topper Reviewed By: craig.topper Subscribers: llvm-commits, kees, nickdesaulniers Tags: #llvm Differential Revision: https://reviews.llvm.org/D60643 llvm-svn: 358343
* Reapply [VFS] Allow multiple RealFileSystem instances with independent CWDs.Sam McCall2019-02-141-1/+86
| | | | | | | | | | This reverts commit r351091. The original mac breakages are addressed by ensuring the root directory we're working from is fully symlink-resolved before starting. Differential Revision: https://reviews.llvm.org/D58169 llvm-svn: 354026
* [VFS] Fix warning and use better check.Michael J. Spencer2019-01-291-1/+1
| | | | llvm-svn: 352527
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Revert "[VFS] Allow multiple RealFileSystem instances with independent CWDs."Amara Emerson2019-01-141-80/+0
| | | | | | This reverts commit r351079, r351069 and r351050 as it broken the greendragon bots on macOS. llvm-svn: 351091
* [VFS] Disable unix-assuming VFS test on windowsSam McCall2019-01-141-1/+1
| | | | llvm-svn: 351079
* [VFS] Allow multiple RealFileSystem instances with independent CWDs.Sam McCall2019-01-141-0/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously only one RealFileSystem instance was available, and its working directory is shared with the process. This doesn't work well for multithreaded programs that want to work with relative paths - the vfs::FileSystem is assumed to provide the working directory, but a thread cannot control this exclusively. The new vfs::createPhysicalFileSystem() factory copies the process's working directory initially, and then allows it to be independently modified. This implementation records the working directory path, and glues it to relative paths to provide the correct absolute path to the sys::fs:: functions. This will give different results in unusual situations (e.g. the CWD is moved). The main alternative is the use of openat(), fstatat(), etc to ask the OS to resolve paths relative to a directory handle which can be kept open. This is more robust. There are two reasons not to do this initially: 1. these functions are not available on all supported Unixes, and are somewhere between difficult and unavailable on Windows. So we need a path-based fallback anyway. 2. this would mean also adding support at the llvm::sys::fs level, which is a larger project. My clearest idea is an OS-specific `BaseDirectory` object that can be optionally passed to functions there. Eventually this could be backed by either paths or a fd where openat() is supported. This is a large project, and demonstrating here that a path-based fallback works is a useful prerequisite. There is some subtlety to the path-manipulation mechanism: - when setting the working directory, both Specified=makeAbsolute(path) and Resolved=realpath(path) are recorded. These may differ in the presence of symlinks. - getCurrentWorkingDirectory() and makeAbsolute() use Specified - this is similar to the behavior of $PWD and sys::path::current_path - IO operations like openFileForRead use Resolved. This is similar to the behavior of an openat() based implementation, that doesn't see changes in symlinks. There may still be combinations of operations and FS states that yield unhelpful behavior. This is hard to avoid with symlinks and FS abstractions :( The caching behavior of the current working directory is removed in this patch. getRealFileSystem() is now specified to link to the process CWD, so the caching is incorrect. The user who needed this so far is clangd, which will immediately switch to createPhysicalFileSystem(). Reviewers: ilya-biryukov, bkramer, labath Subscribers: ioeric, kadircet, kristina, llvm-commits Differential Revision: https://reviews.llvm.org/D56545 llvm-svn: 351050
* [VFS] Add isLocal to ProxyFileSystem and add unit tests.Michael J. Spencer2018-12-171-0/+37
| | | | | | Differential Revision: https://reviews.llvm.org/D55789 llvm-svn: 349410
* [VFS] Update unittest to fix Windows buildbot.Volodymyr Sapsai2018-11-161-6/+6
| | | | | | | | | Buildbot http://lab.llvm.org:8011/builders/clang-x64-windows-msvc is failing because it doesn't like paths in VFS, make them more Windows-friendly. Follow up to r347009. llvm-svn: 347016
* [VFS] Implement `RedirectingFileSystem::getRealPath`.Volodymyr Sapsai2018-11-161-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | It fixes the case when Objective-C framework is added as a subframework through a symlink. When parent framework infers a module map and fails to detect a symlink, it would add a subframework as a submodule. And when we parse module map for the subframework, we would encounter an error like > error: umbrella for module 'WithSubframework.Foo' already covers this directory By implementing `getRealPath` "an egregious but useful hack" in `ModuleMap::inferFrameworkModule` works as expected. rdar://problem/45821279 Reviewers: bruno, benlangmuir, erik.pilkington Reviewed By: bruno Subscribers: hiraditya, dexonsmith, JDevlieghere, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D54245 llvm-svn: 347009
* Revert "[VFS] Add "expand tilde" argument to getRealPath."Sam McCall2018-11-091-2/+2
| | | | | | | This reverts commit r346453. This is a complex change to a widely-used interface, and was not reviewed. llvm-svn: 346500
* [VFS] Add "expand tilde" argument to getRealPath.Jonas Devlieghere2018-11-091-2/+2
| | | | | | | Add an optional argument to expand tildes in the path to mirror llvm's implementation of the corresponding function. llvm-svn: 346453
* Extend virtual file system with `isLocal` methodJonas Devlieghere2018-11-081-0/+11
| | | | | | | | Expose the `llvm::sys::fs::is_local` function through the VFS. Differential revision: https://reviews.llvm.org/D54127 llvm-svn: 346372
* [VFS] Add support for "no_push" to VFS recursive iterators.Jonas Devlieghere2018-10-311-0/+79
| | | | | | | | | | | The "regular" file system has a useful feature that makes it possible to stop recursing when using the recursive directory iterators. This functionality was missing for the VFS recursive iterator and this patch adds that. Differential revision: https://reviews.llvm.org/D53465 llvm-svn: 345793
* [VFS] Add property 'fallthrough' that controls fallback to real file system.Volodymyr Sapsai2018-10-261-0/+86
| | | | | | | | | | | | | | | | | | | | | | | | Default property value 'true' preserves current behavior. Value 'false' can be used to create VFS "root", file system that gives better control over which files compiler can use during compilation as there are no unpredictable accesses to real file system. Non-fallthrough use case changes how we treat multiple VFS overlay files. Instead of all of them being at the same level just above a real file system, now they are nested and subsequent overlays can refer to files in previous overlays. rdar://problem/39465552 Reviewers: bruno, benlangmuir Reviewed By: bruno Subscribers: dexonsmith, cfe-commits, hiraditya Differential Revision: https://reviews.llvm.org/D50539 llvm-svn: 345431
* Lift VFS from clang to llvm (NFC)Jonas Devlieghere2018-10-101-0/+1601
This patch moves the virtual file system form clang to llvm so it can be used by more projects. Concretely the patch: - Moves VirtualFileSystem.{h|cpp} from clang/Basic to llvm/Support. - Moves the corresponding unit test from clang to llvm. - Moves the vfs namespace from clang::vfs to llvm::vfs. - Formats the lines affected by this change, mostly this is the result of the added llvm namespace. RFC on the mailing list: http://lists.llvm.org/pipermail/llvm-dev/2018-October/126657.html Differential revision: https://reviews.llvm.org/D52783 llvm-svn: 344140
OpenPOWER on IntegriCloud