summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Basic/FileManagerTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use VFS operations in FileManager::makeAbsolutePath.Ilya Biryukov2017-08-021-0/+27
| | | | | | | | | | | | | | Summary: It used to call into llvm::sys::fs::make_absolute. Reviewers: akyrtzi, erikjv, bkramer, krasimir, klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D36155 llvm-svn: 309795
* FileManager: mark virtual file entries as valid entriesErik Verbruggen2017-03-281-2/+50
| | | | | | | | | | | | | | | | | | The getVirtualFile method would create entries for e.g. libclang's CXUnsavedFile but not mark them as valid. The effect is that a lookup through getFile where the file name is not exactly matching the virtual file (e.g. through mixing slashes and backslashes on Windows) would result in a normal file "lookup", and re-using the file entry found by using the UniqueID, and overwrite the file entry fields. Because the lookup involves opening the file, and moving it into the file entry, the file is now open. The SourceManager keys its buffers on the UniqueID (which is still the same), so it will find an already loaded buffer. Because only the loading a buffer from disk will close the file, the FileEntry will hold on to an open file for as long as the FileManager is around. As the FileManager will only get destroyed at a reparse, you can't safe to the "leaked" and locked file on Windows. llvm-svn: 298905
* Turn FileManager DirectoryEntry::Name from raw pointer to StringRef (NFC)Mehdi Amini2016-10-111-8/+8
| | | | llvm-svn: 283856
* Store FileEntry::Filename as a StringRef instead of raw pointer (NFC)Mehdi Amini2016-10-101-2/+2
| | | | llvm-svn: 283815
* Add missing include.Benjamin Kramer2015-03-011-0/+1
| | | | llvm-svn: 230910
* [cleanup] Re-sort the #include lines using llvm/utils/sort_includes.pyChandler Carruth2015-01-141-1/+1
| | | | | | | No functionality changed, this is a purely mechanical cleanup to ensure the #include order remains consistent across the project. llvm-svn: 225975
* unique_ptr-ify FileSystemStatCache::setNextStatCacheDavid Blaikie2014-08-111-13/+22
| | | | | | | | | | And in the process, discover that FileManager::removeStatCache had a double-delete when removing an element from the middle of the list (at the beginning or the end of the list, there was no problem) and add a unit test to exercise the code path (which successfully crashed when run (with modifications to match the old API) without this patch applied) llvm-svn: 215388
* Update unit test for signature change.Benjamin Kramer2014-07-081-2/+3
| | | | llvm-svn: 212545
* [C++11] Use 'nullptr'. Unittests edition.Craig Topper2014-06-081-17/+17
| | | | llvm-svn: 210423
* Remove the last remaining llvm/Config/config.h includesAlp Toker2014-06-041-1/+1
| | | | | | | | | | | | This corrects long-standing misuses of LLVM's internal config.h. In most cases the public llvm-config.h header was intended and we can now remove the old hacks thanks to LLVM r210144. The config.h header is private, won't be installed and should no longer be included by clang or other modules. llvm-svn: 210145
* Check for LLVM_ON_WIN32 instead of _WIN32.Hans Wennborg2014-03-121-4/+5
| | | | | | This is a follow-up to r203624 to address Anton's comment. llvm-svn: 203668
* Reapply fixed "Honour 'use-external-names' in FileManager"Ben Langmuir2014-02-281-3/+6
| | | | | | | | | | | | | | | | 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
* Revert "Honour 'use-external-names' in FileManager"Ben Langmuir2014-02-271-1/+0
| | | | | | Revert r202442, which broke the buildbots. llvm-svn: 202443
* Honour 'use-external-names' in FileManagerBen Langmuir2014-02-271-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
* Recommit virtual file systemBen Langmuir2014-02-201-1/+1
| | | | | | | | | | | 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
* Reverting the virtual file system implementation, because it triggers an ↵Juergen Ributzka2014-02-201-1/+1
| | | | | | | | | | assertion in our internal build bots. This reverts commits 201618, 201635, 201636, 201639, 201685, 201691, and 201696. llvm-svn: 201755
* Initial implementation of virtual file systemBen Langmuir2014-02-191-1/+1
| | | | | | | | | | | | 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
* Use llvm::sys::fs::UniqueID for windows and unix.Rafael Espindola2013-08-011-13/+10
| | | | | | | | | | | | | | | | | | | 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
* Fix handling of "clang c:foo"Rafael Espindola2013-07-291-0/+17
| | | | | | | | | | | | | On windows, c:foo is a valid file path, but stat fails on just "c:". This causes a problem for clang since its file manager wants to cache data about the parent directory. There are refactorings to be done in here, but this gives clang the correct behavior and testing first. Patch by Yunzhong Gao! llvm-svn: 187359
* Extend stat query APIs to explicitly specify if the query is forArgyrios Kyrtzidis2012-12-111-1/+1
| | | | | | | | | | 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
* Sort the #include lines for unittests/...Chandler Carruth2012-12-041-2/+1
| | | | | | I've tried to place sensible headers at the top as main-module headers. llvm-svn: 169243
* unittests/Basic/FileManagerTest.cpp: Suppress warnings on gcc.NAKAMURA Takumi2011-09-231-1/+2
| | | | llvm-svn: 140364
* unittests/Basic/FileManagerTest.cpp: Unbreak Win32, mingw and msvc.NAKAMURA Takumi2011-06-241-3/+3
| | | | | | | LLVM_ON_WIN32 is defined in llvm/Config/config.h. IMO, it might be enough with _WIN32 in most cases, LLVM_ON_xxx could be deprecated. llvm-svn: 133794
* Moves FileManagerTest.cpp to unittests/Basic such that the unit testZhanyong Wan2011-02-151-0/+222
directory structure matches the library structure. Reviewed by jyasskin. llvm-svn: 125600
OpenPOWER on IntegriCloud