summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Basic/VirtualFileSystemTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Reapply [2] [VFS] Add 'overlay-relative' field to YAML filesBruno Cardoso Lopes2016-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reapplies r261552 and r263748. Fixed testcase to reapply. The VFS overlay mapping between virtual paths and real paths is done through the 'external-contents' entries in YAML files, which contains hardcoded paths to the real files. When a module compilation crashes, headers are dumped into <name>.cache/vfs directory and are mapped via the <name>.cache/vfs/vfs.yaml. The script generated for reproduction uses -ivfsoverlay pointing to file to gather the mapping between virtual paths and files inside <name>.cache/vfs. Currently, we are only capable of reproducing such crashes in the same machine as they happen, because of the hardcoded paths in 'external-contents'. To be able to reproduce a crash in another machine, this patch introduces a new option in the VFS yaml file called 'overlay-relative'. When it's equal to 'true' it means that the provided path to the YAML file through the -ivfsoverlay option should also be used to prefix the final path for every 'external-contents'. Example, given the invocation snippet "... -ivfsoverlay <name>.cache/vfs/vfs.yaml" and the following entry in the yaml file: "overlay-relative": "true", "roots": [ ... "type": "directory", "name": "/usr/include", "contents": [ { "type": "file", "name": "stdio.h", "external-contents": "/usr/include/stdio.h" }, ... Here, a file manager request for virtual "/usr/include/stdio.h", that will map into real path "/<absolute_path_to>/<name>.cache/vfs/usr/include/stdio.h. This is a useful feature for debugging module crashes in machines other than the one where the error happened. Differential Revision: http://reviews.llvm.org/D17457 rdar://problem/24499339 llvm-svn: 263893
* Revert "Reapply [VFS] Add 'overlay-relative' field to YAML files"Bruno Cardoso Lopes2016-03-171-1/+1
| | | | | | | | | Tests failing on http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/46102 This reverts commit a1683cd6c9e07359c09f86e98a4db6b4e1bc51fc. llvm-svn: 263750
* Reapply [VFS] Add 'overlay-relative' field to YAML filesBruno Cardoso Lopes2016-03-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reapplies r261552. The VFS overlay mapping between virtual paths and real paths is done through the 'external-contents' entries in YAML files, which contains hardcoded paths to the real files. When a module compilation crashes, headers are dumped into <name>.cache/vfs directory and are mapped via the <name>.cache/vfs/vfs.yaml. The script generated for reproduction uses -ivfsoverlay pointing to file to gather the mapping between virtual paths and files inside <name>.cache/vfs. Currently, we are only capable of reproducing such crashes in the same machine as they happen, because of the hardcoded paths in 'external-contents'. To be able to reproduce a crash in another machine, this patch introduces a new option in the VFS yaml file called 'overlay-relative'. When it's equal to 'true' it means that the provided path to the YAML file through the -ivfsoverlay option should also be used to prefix the final path for every 'external-contents'. Example, given the invocation snippet "... -ivfsoverlay <name>.cache/vfs/vfs.yaml" and the following entry in the yaml file: "overlay-relative": "true", "roots": [ ... "type": "directory", "name": "/usr/include", "contents": [ { "type": "file", "name": "stdio.h", "external-contents": "/usr/include/stdio.h" }, ... Here, a file manager request for virtual "/usr/include/stdio.h", that will map into real path "/<absolute_path_to>/<name>.cache/vfs/usr/include/stdio.h. This is a useful feature for debugging module crashes in machines other than the one where the error happened. Differential Revision: http://reviews.llvm.org/D17457 rdar://problem/24499339 llvm-svn: 263748
* Revert "[VFS] Add 'overlay-relative' field to YAML files" and "[VFS] Fix ↵Bruno Cardoso Lopes2016-02-231-1/+1
| | | | | | | | | | | | | | | call to getVFSFromYAML in unittests" This reverts commit r261552 and r261556 because of failing unittests on windows: Failing Tests (4): Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.CaseInsensitive Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.DirectoryIteration Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.MappedFiles Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.UseExternalName llvm-svn: 261613
* [VFS] Fix call to getVFSFromYAML in unittestsBruno Cardoso Lopes2016-02-221-1/+1
| | | | | | Follow up from r261552 llvm-svn: 261556
* Fix Clang-tidy modernize-use-nullptr warnings; other minor fixes.Eugene Zelenko2016-01-261-2/+1
| | | | | | Differential revision: http://reviews.llvm.org/D16567 llvm-svn: 258836
* Simplify test code with initializer lists.Benjamin Kramer2016-01-101-47/+16
| | | | | | No functional change intended. llvm-svn: 257287
* Make test work on windows by turning \ in paths back into /.Benjamin Kramer2016-01-101-2/+8
| | | | llvm-svn: 257286
* [vfs] Normalize working directory if requested.Benjamin Kramer2016-01-091-0/+6
| | | | | | | | FixedCompilationDatabase sets the working dir to "." by default. For chdir(".") this is a noop but this lead to InMemoryFileSystem to create bogus paths. Fixes PR25327. llvm-svn: 257260
* [VFS] Fix status() of opened redirected fileBen Langmuir2015-12-101-1/+26
| | | | | | | | | | | | | | | Make RedirectedFileSystem::openFilForRead(path)->status() the same as RedirectedFileSystem::status(path). Previously we would just get the status of the underlying real file, which would not have the IsVFSMapped bit set. This fixes rebuilding a module that has an include that is relative to the includer where we will lookup the real path of that file before we lookup the VFS location. rdar://problem/23640339 llvm-svn: 255312
* [VFS] Let the user decide if they want path normalization.Benjamin Kramer2015-10-121-2/+31
| | | | | | | | | | | | | | This is a more principled version of what I did earlier. Path normalization is generally a good thing, but may break users in strange environments, e. g. using lots of symlinks. Let the user choose and default it to on. This also changes adding a duplicated file into returning an error if the file contents are different instead of an assertion failure. Differential Revision: http://reviews.llvm.org/D13658 llvm-svn: 250060
* [VFS] Unbreak test.Benjamin Kramer2015-10-121-2/+0
| | | | llvm-svn: 250037
* [VFS] Don't try to be heroic with '.' in paths.Benjamin Kramer2015-10-121-5/+3
| | | | | | | Actually the only special path we have to handle is ./foo, the rest is tricky to get right so do the same thing as the existing YAML vfs here. llvm-svn: 250036
* [VFS] remove handling of '..' for now.Benjamin Kramer2015-10-121-3/+0
| | | | | | | | | This can fail badly if we're overlaying a real file system and there are symlinks there. Just keep the path as-is for now. This essentially reverts r249830. llvm-svn: 250021
* [VFS] Just normalize away .. and . in paths for in-memory file systems.Benjamin Kramer2015-10-091-0/+3
| | | | | | This simplifies the code and gets us support for .. for free. llvm-svn: 249830
* [VFS] Also drop '.' when adding files to an in-memory FS.Benjamin Kramer2015-10-071-0/+3
| | | | | | Otherwise we won't be able to find them later. llvm-svn: 249525
* Fix Clang-tidy modernize-use-nullptr warnings in source directories; other ↵Hans Wennborg2015-10-061-2/+3
| | | | | | | | | | minor cleanups Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D13406 llvm-svn: 249484
* [VFS] Put the incoming name in the file status to make InMemoryFS behave ↵Benjamin Kramer2015-10-061-0/+13
| | | | | | more like a real FS. llvm-svn: 249409
* BasicTests: Suppress InMemoryFileSystemTest.WindowsPath on win32 while ↵NAKAMURA Takumi2015-10-061-0/+2
| | | | | | investigating. llvm-svn: 249395
* [VFS] Transition clang-format to use an in-memory FS.Benjamin Kramer2015-10-061-0/+12
| | | | | | | | | | | Apart from being cleaner this also means that clang-format no longer has access to the host file system. This isn't necessary because clang-format never reads includes :) Includes minor tweaks and bugfixes found in the VFS implementation while running clang-format tests. llvm-svn: 249385
* Fix the MSVC build.Rafael Espindola2015-10-051-4/+4
| | | | | | No idea what asymmetry MSVC is findind. llvm-svn: 249346
* [VFS] Add working directories to every virtual file system.Benjamin Kramer2015-10-051-0/+6
| | | | | | | | | | | | For RealFileSystem this is getcwd()/chdir(), the synthetic file systems can make up one for themselves. OverlayFileSystem now synchronizes the working directories when a new FS is added to the overlay or the overlay working directory is set. This allows purely artificial file systems that have zero ties to the underlying disks. Differential Revision: http://reviews.llvm.org/D13430 llvm-svn: 249316
* [VFS] Add an in-memory file system implementation.Benjamin Kramer2015-10-051-0/+67
| | | | | | | | | | This is a simple file system tree of memory buffers that can be filled by a client. In conjunction with an OverlayFS it can be used to make virtual files accessible right next to physical files. This can be used as a replacement for the virtual file handling in FileManager and which I intend to remove eventually. llvm-svn: 249315
* [VFS] Remove setName from the file interface.Benjamin Kramer2015-10-051-6/+6
| | | | | | | This streamlines the interface a bit and makes Status more immutable. No functional change intended. llvm-svn: 249310
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-1/+1
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-1/+1
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-111-3/+1
| | | | | | | | | | | | | | | | | | | | Summary: 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 Reviewers: dblaikie Reviewed By: dblaikie Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D8926 llvm-svn: 234678
* Make VFS and FileManager match the current MemoryBuffer API.Benjamin Kramer2014-10-261-8/+2
| | | | | | | This eliminates converting back and forth between the 3 formats and gives us a more homogeneous interface. llvm-svn: 220657
* Adds 'override' to overriding methods. NFC.Fariborz Jahanian2014-10-011-2/+2
| | | | | | These were uncoveredby my yet undelivered patch. llvm-svn: 218774
* Update for LLVM api change.Rafael Espindola2014-08-271-1/+1
| | | | llvm-svn: 216585
* Create a std::unique_ptr earlier.Rafael Espindola2014-08-171-3/+3
| | | | | | Thanks to David Blaikie for the suggestion. llvm-svn: 215865
* Convert a few ownership comments with std::unique_ptr.Rafael Espindola2014-08-171-1/+2
| | | | llvm-svn: 215853
* Track IntrusiveRefCntPtr::get() changes from LLVM r212366Alp Toker2014-07-051-36/+36
| | | | llvm-svn: 212369
* Add vfs::recursive_directory_iteratorBen Langmuir2014-06-251-6/+102
| | | | | | | | | For now, this is only used by its unit tests. It is similar to the API in llvm::sys::fs::recursive_directory_iterator, but without some of the more complex features like requesting that the iterator not recurse into the next directory, for example. llvm-svn: 211732
* VirtualFileSystemTest.cpp: Get rid of initializer list on std::vector, to ↵NAKAMURA Takumi2014-06-251-21/+29
| | | | | | appease msc17. llvm-svn: 211662
* Reformat.NAKAMURA Takumi2014-06-251-10/+9
| | | | llvm-svn: 211661
* Fix test issues from r211623 and remove test-only APIBen Langmuir2014-06-241-18/+21
| | | | | | | | | | | 1) missing iterator bits needed by libstdc++4.7 Using find_if was convenient, but since operator++ wasn't a good interface anyway, I just replaced with a range-based for loop and removed operator++ from the directory_iterator class. 2) stop relying on order of iterating real files llvm-svn: 211633
* Disable the bits of r211623 that broke the botsBen Langmuir2014-06-241-15/+16
| | | | | | | Part of my test seems to rely on iterator bits that I didn't implement, at least in the gcc bots. Disabling while I investigate. llvm-svn: 211625
* Add directory_iterator for (non-recursive) iteration of VFS directoriesBen Langmuir2014-06-241-0/+242
| | | | | | | | The API is based on sys::fs::directory_iterator, but it allows iterating over overlays and the yaml-based VFS. For now, it isn't used by anything (except its tests). llvm-svn: 211623
* Update for llvm api change.Rafael Espindola2014-06-131-6/+7
| | | | llvm-svn: 210921
* Refer to error_code with the std prefix.Rafael Espindola2014-06-121-13/+14
| | | | llvm-svn: 210817
* Fix msvc unittest build.Rafael Espindola2014-06-121-1/+1
| | | | | | Looks like msvc has an asymmetrical operator ==. llvm-svn: 210768
* Use std::error_code instead of llvm::error_code.Rafael Espindola2014-06-111-5/+6
| | | | | | This is an update for a llvm api change. llvm-svn: 210688
* [C++11] Use 'nullptr'. Unittests edition.Craig Topper2014-06-081-35/+35
| | | | llvm-svn: 210423
* There is no std::errc:success, remove the llvm one.Rafael Espindola2014-05-311-39/+39
| | | | llvm-svn: 209959
* Use make_error_code in preparation for making errc an enum class.Rafael Espindola2014-05-311-1/+1
| | | | llvm-svn: 209956
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-071-2/+3
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
* Attempt to re-enable the VFS unittests on WindowsBen Langmuir2014-03-051-72/+72
| | | | | | | Using a //net/ path to hopefully avoid problems with non-absolute paths on Windows. llvm-svn: 203010
* Disable BasicTests/VFS on win32 for now. Investigating.NAKAMURA Takumi2014-03-051-0/+2
| | | | | | | | | | | Failing Tests (5): Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.CaseInsensitive Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.MappedFiles Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.MultiComponentPath Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.TrailingSlashes Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.UseExternalName llvm-svn: 202952
* Add a 'use-external-names' option to VFS overlay filesBen Langmuir2014-02-271-2/+52
| | | | | | | | | | | | | | | | When true, sets the name of the file to be the name from 'external-contents'. Otherwise, you get the virtual path that the file was looked up by. This will not affect any non-virtual paths, or fully virtual paths (for which there is no reasonable 'external' name anyway). The setting is available globally, but can be overriden on a per-file basis. The goal is that this setting will control which path you see in debug info, diagnostics, etc. which are sensitive to which path is used. That will come in future patches that pass the name through to FileManager. llvm-svn: 202329
OpenPOWER on IntegriCloud