aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/FileSystemStatCache.cpp
AgeCommit message (Collapse)AuthorFilesLines
2019-04-16[FileSystemStatCache] Return std::error_code from stat cache methodsHarlan Haskins1-20/+21
Summary: Previously, we would return true/false signifying if the cache/lookup succeeded or failed. Instead, provide clients with the underlying error that was thrown while attempting to look up in the cache. Since clang::FileManager doesn't make use of this information, it discards the error that's received and casts away to bool. This change is NFC. Reviewers: benlangmuir, arphaman Subscribers: dexonsmith, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60735 llvm-svn: 358509
2019-03-05Replace clang::FileData with llvm::vfs::StatusHarlan Haskins1-25/+15
Summary: FileData was only ever used as a container for the values in llvm::vfs::Status, so they might as well be consolidated. The `InPCH` member was also always set to false, and unused. Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58924 llvm-svn: 355368
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth1-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
2018-12-21Remove stat cache chaining as it's no longer needed after PTH support has beenAlex Lorenz1-9/+8
removed Stat cache chaining was implemented for a StatListener in the PTH writer so that it could write out the stat information to PTH. r348266 removed support for PTH, and it doesn't seem like there are other uses of stat cache chaining. We can remove the chaining support. Differential Revision: https://reviews.llvm.org/D55455 llvm-svn: 349942
2018-10-10Lift VFS from clang to llvm (NFC)Jonas Devlieghere1-7/+9
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
2018-07-30Remove trailing spaceFangrui Song1-4/+4
sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338291
2018-03-28[Basic] Fix some Clang-tidy modernize and Include What You Use warnings; ↵Eugene Zelenko1-2/+5
other minor fixes (NFC). llvm-svn: 328735
2016-11-09[VFS] Replace TimeValue usage with std::chronoPavel Labath1-1/+1
Summary: NFCI Reviewers: benlangmuir, zturner Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25948 llvm-svn: 286356
2016-10-11Turn FileManager DirectoryEntry::Name from raw pointer to StringRef (NFC)Mehdi Amini1-2/+2
llvm-svn: 283856
2015-06-11[cleanup] Remove some unused #ifdef'sSean Silva1-11/+0
This is all going through the VFS layer now, so there's nothing platform-specific here. llvm-svn: 239573
2014-10-26Make VFS and FileManager match the current MemoryBuffer API.Benjamin Kramer1-5/+4
This eliminates converting back and forth between the 3 formats and gives us a more homogeneous interface. llvm-svn: 220657
2014-07-08Improve memory ownership of vfs::Files in the FileSystemStatCache by using ↵David Blaikie1-8/+5
std::unique_ptr Spotted after a memory leak (due to the complexities of manual memory management) was fixed in 212466. llvm-svn: 212541
2014-07-07Fix memory leak in FileSystemStatCache.Manuel Klimek1-0/+1
Patch by Guochun Shi. llvm-svn: 212466
2014-06-12Replace llvm::error_code with std::error_code.Rafael Espindola1-1/+1
llvm-svn: 210780
2014-05-23Stopgap fix for finding module for a file mapped in the VFSBen Langmuir1-0/+1
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-08[C++11] Use 'nullptr'.Craig Topper1-2/+2
llvm-svn: 208280
2014-03-07Replace OwningPtr with std::unique_ptr.Ahmed Charles1-1/+1
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-02-28Reapply fixed "Honour 'use-external-names' in FileManager"Ben Langmuir1-0/+1
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-1/+0
Revert r202442, which broke the buildbots. llvm-svn: 202443
2014-02-27Honour 'use-external-names' in FileManagerBen Langmuir1-0/+1
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-20Recommit virtual file systemBen Langmuir1-21/+23
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
2014-02-20Reverting the virtual file system implementation, because it triggers an ↵Juergen Ributzka1-23/+21
assertion in our internal build bots. This reverts commits 201618, 201635, 201636, 201639, 201685, 201691, and 201696. llvm-svn: 201755
2014-02-19Initial implementation of virtual file systemBen Langmuir1-21/+23
This adds the minimum virtual file system support to start migrating FileManager onto the VFS. Originally discussed here: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-February/035188.html Differential Revision: http://llvm-reviews.chandlerc.com/D2745 llvm-svn: 201618
2013-08-01Use llvm::sys::fs::UniqueID for windows and unix.Rafael Espindola1-16/+32
This unifies the unix and windows versions of FileManager::UniqueDirContainer and FileManager::UniqueFileContainer by using UniqueID. We cannot just replace "struct stat" with llvm::sys::fs::file_status, since we want to be able to construct fake ones, and file_status has different members on unix and windows. What the patch does is: * Record only the information that clang is actually using. * Use llvm::sys::fs::status instead of stat and fstat. * Use llvm::sys::fs::UniqueID * Delete the old windows versions of UniqueDirContainer and UniqueFileContainer since the "unix" one now works on windows too. llvm-svn: 187619
2013-07-16Update for llvm API change.Rafael Espindola1-8/+4
llvm-svn: 186448
2012-12-11Extend stat query APIs to explicitly specify if the query is forArgyrios Kyrtzidis1-9/+11
a file or directory, allowing just a stat call if a file descriptor is not needed. Doing just 'stat' is faster than 'open/fstat/close'. This has the effect of cutting down system time for validating the input files of a PCH. llvm-svn: 169831
2011-12-20Unweaken vtables as per ↵David Blaikie1-0/+2
http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146959
2010-12-17Replace all uses of PathV1::isAbsolute with PathV2::is_{absolute,relative}.Michael J. Spencer1-1/+1
llvm-svn: 122087
2010-12-02attempt to fix a buildbot failure, apparently apache fails to build.Chris Lattner1-1/+1
llvm-svn: 120688
2010-11-29Merge System into Support.Michael J. Spencer1-1/+1
llvm-svn: 120297
2010-11-24Fix 2 problems with Chris Lattner's FileManager redesign on Windows.Francois Pichet1-1/+1
- FileEntry::operator= is needed on Win32. - There was an error in the S_ISDIR() macro. llvm-svn: 120079
2010-11-23The final result of all this refactoring: instead of doing stat immediatelyChris Lattner1-3/+38
followed by an open for every source file we open, probe the file system with 'open' and then do an fstat when it succeeds. open+fstat is faster than stat+open because the kernel only has to perform the string->inode mapping once. Presumably it gets faster the deeper in your filesystem a lookup happens. For -Eonly on cocoa.h, this reduces system time from 0.042s to 0.039s on my machine, a 7.7% speedup. llvm-svn: 120066
2010-11-23if we succeed in opening a directory but expected a file, ensure we don'tChris Lattner1-1/+22
leak a filedescriptor if a client ever starts returning one. llvm-svn: 120062
2010-11-23change the 'is directory' indicator to be a null-or-notChris Lattner1-2/+28
pointer that is passed down through the APIs, and make FileSystemStatCache::get be the one that filters out directory lookups that hit files. This also paves the way to have stat queries be able to return opened files. llvm-svn: 120060
2010-11-23replicate a terrible hack to fix a build error on VC++Chris Lattner1-0/+4
llvm-svn: 120039
2010-11-23simplify the cache miss handling code, eliminating CacheMissing.Chris Lattner1-6/+1
llvm-svn: 120038
2010-11-23r120013 dropped passing in the precomputed file size to Chris Lattner1-1/+0
MemoryBuffer::getFile, causing us to pick up a fstat for every file. Restore the optimization. llvm-svn: 120032
2010-11-23PCH files only cache successful stats. Remove the code that reads/writes Chris Lattner1-1/+1
the result code of the stat to/from the PCH file since it is always 0. llvm-svn: 120031
2010-11-23rework the stat cache, pulling it out of FileManager.h intoChris Lattner1-0/+40
its own header and giving it some more structure. No functionality change. llvm-svn: 120030