aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/VirtualFileSystem.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-10-05[VFS] Remove setName from the file interface.Benjamin Kramer1-36/+62
This streamlines the interface a bit and makes Status more immutable. No functional change intended. llvm-svn: 249310
2015-06-24Remove a limited and somewhat questionable DenseMapInfo specializationChandler Carruth1-14/+0
for StringRef now that the core DenseMap library provides this facility. llvm-svn: 240530
2015-06-22Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko1-2/+2
llvm-svn: 240353
2015-06-22Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko1-2/+2
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
2015-04-11Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko1-3/+3
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
2015-03-18Remove many superfluous SmallString::str() calls.Yaron Keren1-2/+2
Now that SmallString is a first-class citizen, most SmallString::str() calls are not required. This patch removes a whole bunch of them, yet there are lots more. There are two use cases where str() is really needed: 1) To use one of StringRef member functions which is not available in SmallString. 2) To convert to std::string, as StringRef implicitly converts while SmallString do not. We may wish to change this, but it may introduce ambiguity. llvm-svn: 232622
2015-01-14[cleanup] Re-sort *all* #include lines with llvm/utils/sort_includes.pyChandler Carruth1-1/+1
Sorry for the noise, I managed to miss a bunch of recent regressions of include orderings here. This should actually sort all the includes for Clang. Again, no functionality changed, this is just a mechanical cleanup that I try to run periodically to keep the #include lines as regular as possible across the project. llvm-svn: 225979
2014-11-19Update for LLVM API changeDavid Blaikie1-1/+1
llvm-svn: 222303
2014-10-26Make VFS and FileManager match the current MemoryBuffer API.Benjamin Kramer1-49/+34
This eliminates converting back and forth between the 3 formats and gives us a more homogeneous interface. llvm-svn: 220657
2014-08-27Update for llvm API change.Rafael Espindola1-1/+1
llvm-svn: 216576
2014-08-17Update for llvm api changes.Rafael Espindola1-1/+1
llvm-svn: 215856
2014-08-17Convert a few ownership comments with std::unique_ptr.Rafael Espindola1-8/+7
llvm-svn: 215853
2014-07-15VirtualFileSystem: Correctly generate the mapping for an empty VFSJustin Bogner1-23/+22
In r209332 I accidentally broke generation of empty VFS maps. This fixes the issue and adds a test. llvm-svn: 213028
2014-07-06Update for llvm api change.Rafael Espindola1-3/+8
llvm-svn: 212408
2014-06-25Add vfs::recursive_directory_iteratorBen Langmuir1-0/+35
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
2014-06-24Add directory_iterator for (non-recursive) iteration of VFS directoriesBen Langmuir1-7/+191
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
2014-06-13Update for llvm api change.Rafael Espindola1-12/+13
llvm-svn: 210921
2014-06-12Refer to error_code with the std prefix.Rafael Espindola1-39/+41
llvm-svn: 210817
2014-06-12Add a std:: prefix in cases where ADL would have failed on windows.Rafael Espindola1-8/+8
This is in preparation for removing make_error_code from the llvm namespace. llvm-svn: 210745
2014-06-12Use generic_category from the std namespace.Rafael Espindola1-1/+1
llvm-svn: 210736
2014-06-12Errno should use generic_category.Rafael Espindola1-1/+1
Sorry, no testcase, just noticed while trying to remove llvm's system_error.h llvm-svn: 210727
2014-06-11Use std::error_code instead of llvm::error_code.Rafael Espindola1-12/+12
This is an update for a llvm api change. llvm-svn: 210688
2014-05-31Use make_error_code in preparation for making errc an enum class.Rafael Espindola1-8/+8
llvm-svn: 209956
2014-05-31Use error_code() instead of error_code::succes()Rafael Espindola1-3/+3
There is no std::error_code::success, so this removes much of the noise in transitioning to std::error_code. llvm-svn: 209949
2014-05-23Stopgap fix for finding module for a file mapped in the VFSBen Langmuir1-2/+4
If we lookup a path using its 'real' path first, we need to ensure that when we run header search we still use the VFS-mapped path or we will not be able to find the corresponding module for the header. The real problem is that we tie the name of a file to its underlying FileEntry, which is uniqued by inode, so we only ever get the first name it is looked up by. This doesn't work with modules, which rely on a specific file system structure. I'm hoping to have time to write up a proposal for fixing this more permanently soon, but as a stopgap this patch updates the name of the file's directory if it comes from a VFS mapping. llvm-svn: 209534
2014-05-21VirtualFileSystem: Fix a few directory traversal bugs in VFSWriterJustin Bogner1-81/+92
There are a couple of issues with writing VFS maps that are awkward to fix within the current mutually recursive approach. Instead, replace the algorithm with an iterative version that uses an explicit stack of directories. Includes tests for cases the old approach was tripping on. llvm-svn: 209332
2014-05-20VirtualFileSystem: Fix false positives in YAMLVFSWriter::containedInJustin Bogner1-1/+10
Checking if a path starts with another path isn't sufficient for determining if one is contained within the heirarchy of the other. We need to ensure that the substring ends at a directory boundary. llvm-svn: 209250
2014-05-20VirtualFileSystem: Add YAMLVFSWriter to generate VFS mapping filesJustin Bogner1-0/+116
This moves the logic to write a JSON VFS mapping from the C api into VirtualFileSystem, so that we can use it internally. No functional change. llvm-svn: 209241
2014-05-08[C++11] Use 'nullptr'.Craig Topper1-19/+19
llvm-svn: 208280
2014-05-05[Basic/FileManager] Propagate whether a file 'IsVolatile' to the file ↵Argyrios Kyrtzidis1-5/+9
opening functions. Needs llvm r208007. llvm-svn: 208008
2014-03-10[C++11] Avoid implicit conversion of ArrayRef to std::vector and use move ↵Benjamin Kramer1-5/+1
semantics where appropriate. llvm-svn: 203477
2014-03-09[C++11] Replace OwningPtr include with <memory>.Ahmed Charles1-1/+1
llvm-svn: 203389
2014-03-07Replace OwningPtr with std::unique_ptr.Ahmed Charles1-10/+10
This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
2014-03-07Change OwningPtr::take() to OwningPtr::release().Ahmed Charles1-1/+1
This is a precursor to moving to std::unique_ptr. llvm-svn: 203275
2014-03-05Attempt to re-enable the VFS unittests on WindowsBen Langmuir1-2/+4
Using a //net/ path to hopefully avoid problems with non-absolute paths on Windows. llvm-svn: 203010
2014-03-04Support relative paths in VFSFromYAMLBen Langmuir1-3/+10
Use llvm::sys::fs::make_absolute to get an absolute path before matching. Also, allow "." directories to enable testing. ".." is still not supported, and will require crossing file system boundaries to implement correctly. llvm-svn: 202903
2014-03-02[C++11] Use std::atomic instead of LLVM's.Benjamin Kramer1-3/+3
No intended functionality change. llvm-svn: 202652
2014-03-02Switch all uses of LLVM_OVERRIDE to just use 'override' directly.Craig Topper1-8/+8
llvm-svn: 202625
2014-03-02[C++11] Switch from the llvm_move macro to directly calling std::move.Chandler Carruth1-3/+3
llvm-svn: 202611
2014-03-01Move private classes into anonymous namespaces.Benjamin Kramer1-0/+4
llvm-svn: 202595
2014-02-28Reapply fixed "Honour 'use-external-names' in FileManager"Ben Langmuir1-8/+29
Was r202442 There were two issues with the original patch that have now been fixed. 1. We were memset'ing over a FileEntry in a test case. After adding a std::string to FileEntry, this still happened to not break for me. 2. I didn't pass the FileManager into the new compiler instance in compileModule. This was hidden in some cases by the fact I didn't clear the module cache in the test. Also, I changed the copy constructor for FileEntry, which was memcpy'ing in a (now) unsafe way. llvm-svn: 202539
2014-02-27Revert "Honour 'use-external-names' in FileManager"Ben Langmuir1-29/+8
Revert r202442, which broke the buildbots. llvm-svn: 202443
2014-02-27Honour 'use-external-names' in FileManagerBen Langmuir1-8/+29
Pass through the externally-visible names that we got from the VFS down to FileManager, and test that this is the name showing up in __FILE__, diagnostics, and debug information. llvm-svn: 202442
2014-02-27Add a 'use-external-names' option to VFS overlay filesBen Langmuir1-15/+46
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
2014-02-25Add a driver option -ivfsoverlayBen Langmuir1-1/+1
Reads the description of a virtual filesystem from a file and overlays it over the real file system. llvm-svn: 202176
2014-02-25Allow multi-component paths in VFS file nodesBen Langmuir1-20/+31
This allows the 'name' field to contain a path, like { 'type': 'directory', 'name': '/path/to/dir', 'contents': [ ... ] } which not only simplifies reading and writing these files (for humans), but makes it possible to easily modify locations via textual replacement, which would not have worked in the old scheme. E.g. sed s:<ROOT>:<NEW ROOT> llvm-svn: 202109
2014-02-24Pass through context for DiagHandler in VFSBen Langmuir1-2/+5
This allows the unit tests to not use global state when checking diagnostics. llvm-svn: 202072
2014-02-22Silence a warning from r201905Ben Langmuir1-0/+1
Avoid a warning about reaching the end of a non-void function after a covered switch. llvm-svn: 201919
2014-02-21Add a VFSFromYAML class and a parser to create itBen Langmuir1-4/+576
Provides a way to create a virtual file system using a YAML file that supports mapping a file to a path on an 'external' file system. The external file system will typically be the 'real' file system, but for testing it can be changed. A future patch will add a clang option to allow the user to specify such a file and overlay it, but for now this code is only exercised by the unit tests. Differential Revision: http://llvm-reviews.chandlerc.com/D2835 llvm-svn: 201905
2014-02-20Recommit virtual file systemBen Langmuir1-0/+193
Previously reverted in r201755 due to causing an assertion failure. I've removed the offending assertion, and taught the CompilerInstance to create a default virtual file system inside createFileManager. In the future, we should be able to reach into the CompilerInvocation to customize this behaviour without breaking clients that don't care. llvm-svn: 201818