summaryrefslogtreecommitdiff
path: root/lib/Basic/FileManager.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Use the name of the file on disk to issue a new diagnostic about ↵Taewook Oh2016-06-131-0/+3
| | | | | | | | | | | | | | | non-portable #include and #import paths. Differential Revision: http://reviews.llvm.org/D19843 Corresponding LLVM change: http://reviews.llvm.org/D19842 Re-commit after addressing issues with of generating too many warnings for Windows and asan test failures. Patch by Eric Niebler git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272562 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert commit r271708Taewook Oh2016-06-041-3/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@271761 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the name of the file on disk to issue a new diagnostic about ↵Taewook Oh2016-06-031-0/+3
| | | | | | | | | | | | | non-portable #include and #import paths. Differential Revision: http://reviews.llvm.org/D19843 Corresponding LLVM change: http://reviews.llvm.org/D19842 Patch by Eric Niebler git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@271708 91177308-0d34-0410-b5e6-96231b3b80d8
* [FileManager] Don't crash if reading from stdin and stat(".") failsDavid Majnemer2016-04-121-1/+1
| | | | | | | | | | | | | addAncestorsAsVirtualDirs("<stdin>") quickly returns without doing work because "<stdin>" has no parent_path. This violates the expectation that a subsequent call to getDirectoryFromFile("<stdin>") would succeed. Instead, it fails because it uses the "." if the file has no path component. Fix this by keeping the behavior between addAncestorsAsVirtualDirs and getDirectoryFromFile symmetric. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266089 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the egregious PCHContainer layering hack that doesn't seem to be ↵Benjamin Kramer2016-02-011-5/+0
| | | | | | necessary anymore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259355 91177308-0d34-0410-b5e6-96231b3b80d8
* unique_ptrify some collections in FileManagerDavid Blaikie2015-12-091-16/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255129 91177308-0d34-0410-b5e6-96231b3b80d8
* [Basic] Rangify two for loops. NFC.Vedant Kumar2015-12-091-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255091 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Refactor handling of -fmodules-embed-*. Track this properly ratherRichard Smith2015-11-261-1/+1
| | | | | | | | than reusing the "overridden buffer" mechanism. This will allow us to make embedded files and overridden files behave differently in future. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254121 91177308-0d34-0410-b5e6-96231b3b80d8
* Moving FileManager::removeDotPaths to llvm::sys::path::remove_dotsMike Aizatsky2015-11-091-34/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D14394 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252501 91177308-0d34-0410-b5e6-96231b3b80d8
* Roll-back r250822.Angel Garcia Gomez2015-10-201-2/+2
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250827 91177308-0d34-0410-b5e6-96231b3b80d8
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-201-2/+2
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250822 91177308-0d34-0410-b5e6-96231b3b80d8
* [FileManager] Use StringRef::copy to store canonical paths.Benjamin Kramer2015-08-041-9/+3
| | | | | | No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243970 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Fix issue where building a module from a relative path when ↵Argyrios Kyrtzidis2015-07-311-2/+14
| | | | | | | | | -working-directory option is set, results in error. The error was "module '<name>' was built in directory '<path>' but now resides in directory '<path>' rdar://21330027 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243718 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a comment explaining differing Windows behavior.Sean Silva2015-07-301-1/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243625 91177308-0d34-0410-b5e6-96231b3b80d8
* Attempt to make clang-x64-ninja-win7 happy.Sean Silva2015-07-301-6/+8
| | | | | | | It looks like we were somehow relying somewhere on removing 'foo/./bar' but *not* 'foo/../foo/bar'. Currently investigating. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243600 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid failure to canonicalize '..'.Sean Silva2015-07-301-8/+11
| | | | | | | | | | | | | | Also fix completely broken and untested code which was hiding the primary bug. The !LLVM_ON_UNIX branch of the ifdef was actually a no-op. I ran into this in the wild. It was causing failures in our SDK build. Ideally we'd have a perfect llvm::sys::fs::canonical, but at least this is a step in the right direction, and fixes an obviously broken case. In some sense the test case I've added here is an integration test. We should have these routines thoroughly unit tested in llvm::sys::fs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243597 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the clang module container format selectable from the command line.Adrian Prantl2015-07-171-1/+3
| | | | | | | | | | | | | - introduces a new cc1 option -fmodule-format=[raw,obj] with 'raw' being the default - supports arbitrary module container formats that libclang is agnostic to - adds the format to the module hash to avoid collisions - splits the old PCHContainerOperations into PCHContainerWriter and a PCHContainerReader. Thanks to Richard Smith for reviewing this patch! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242499 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r241770 and add Basic to the dependencies of clang-check instead.Adrian Prantl2015-07-091-0/+3
| | | | | | PR24067. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241782 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the definition of ~PCHContainerOperations from Basic into Frontend.Adrian Prantl2015-07-091-3/+0
| | | | | | Fixes PR24067. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241770 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Revert r241620 and follow-up commits" and move the initializationAdrian Prantl2015-07-081-0/+3
| | | | | | of the llvm targets from clang/CodeGen into ClangCheck.cpp and CIndex.cpp. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241653 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r241620 and follow-up commits while investigating linux buildbot ↵Adrian Prantl2015-07-071-3/+0
| | | | | | failures. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241642 91177308-0d34-0410-b5e6-96231b3b80d8
* Wrap clang modules and pch files in an object file container.Adrian Prantl2015-07-071-0/+3
| | | | | | | | | | | | | This patch adds ObjectFilePCHContainerOperations uses the LLVM backend to put the contents of a PCH into a __clangast section inside a COFF, ELF, or Mach-O object file container. This is done to facilitate module debugging by makeing it possible to store the debug info for the types defined by a module alongside the AST. rdar://problem/20091852 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241620 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove many superfluous SmallString::str() calls.Yaron Keren2015-03-181-1/+1
| | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232622 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] When constructing paths relative to a module, strip out /./ directoryRichard Smith2014-12-111-4/+39
| | | | | | | | components. These sometimes get synthetically added, and we don't want -Ifoo and -I./foo to be treated fundamentally differently here. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224055 91177308-0d34-0410-b5e6-96231b3b80d8
* Standardize on StringMap::insert, removing uses of StringMap::GetOrCreateValue.David Blaikie2014-11-191-34/+35
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222306 91177308-0d34-0410-b5e6-96231b3b80d8
* Make VFS and FileManager match the current MemoryBuffer API.Benjamin Kramer2014-10-261-36/+16
| | | | | | | This eliminates converting back and forth between the 3 formats and gives us a more homogeneous interface. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220657 91177308-0d34-0410-b5e6-96231b3b80d8
* Make FileEntry::getName() valid across calls to FileManager::getFile()Ben Langmuir2014-09-081-2/+15
| | | | | | | | | Because we may change the name of a FileEntry inside getFile, the name returned by FileEntry::getName() could be destroyed. This was causing a use-after-free when searching the HeaderFileInfo on-disk hashtable for a module or pch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217385 91177308-0d34-0410-b5e6-96231b3b80d8
* Return a std::unique_ptr from getBufferForFile. NFC.Rafael Espindola2014-08-261-10/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216476 91177308-0d34-0410-b5e6-96231b3b80d8
* Default getFile() to use the last accessed name in the FileEntry.Manuel Klimek2014-08-131-0/+7
| | | | | | | | | | | | With modules we start accessing headers for the first time while reading the module map, which often has very different paths from the include scanning logic. Using the name by which the file was accessed gets us one step closer to the right solution, which is using a FileName abstraction that decouples the name by which a file was accessed from the FileEntry. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215541 91177308-0d34-0410-b5e6-96231b3b80d8
* unique_ptr-ify FileSystemStatCache::setNextStatCacheDavid Blaikie2014-08-111-6/+6
| | | | | | | | | | 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) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215388 91177308-0d34-0410-b5e6-96231b3b80d8
* unique_ptr-ify FileSystemStatCache::takeNextStatCacheDavid Blaikie2014-08-101-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215318 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove uses of the redundant ".reset(nullptr)" of unique_ptr, in favor of ↵David Blaikie2014-07-191-1/+1
| | | | | | | | | | | ".reset()" It's also possible to just write "= nullptr", but there's some question of whether that's as readable, so I leave it up to authors to pick which they prefer for now. If we want to discuss standardizing on one or the other, we can do that at some point in the future. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213439 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve memory ownership of vfs::Files in the FileSystemStatCache by using ↵David Blaikie2014-07-081-7/+3
| | | | | | | | | std::unique_ptr Spotted after a memory leak (due to the complexities of manual memory management) was fixed in 212466. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212541 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused sys/stat.h includesAlp Toker2014-07-071-3/+0
| | | | | | The facility was abstracted to LLVM in r187364. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212441 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid invalidating successfully loaded module filesBen Langmuir2014-06-201-2/+5
| | | | | | | | | | | | | | | | | Successfully loaded module files may be referenced in other ModuleManagers, so don't invalidate them. Two related things are fixed: 1) I thought the last module in the manager was always the one that failed, but it isn't. So check explicitly against the list of vetted modules from ReadASTCore. 2) We now keep the file descriptor of pcm file open, which avoids the possibility of having two different pcms for the same module loaded when building in parallel with headers being modified during a build. <rdar://problem/16835846> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211330 91177308-0d34-0410-b5e6-96231b3b80d8
* Include system_error directly.Rafael Espindola2014-06-121-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210802 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace llvm::error_code with std::error_code.Rafael Espindola2014-06-121-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210780 91177308-0d34-0410-b5e6-96231b3b80d8
* Stopgap fix for finding module for a file mapped in the VFSBen Langmuir2014-05-231-0/+10
| | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209534 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Use 'nullptr'.Craig Topper2014-05-081-18/+18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208280 91177308-0d34-0410-b5e6-96231b3b80d8
* [Basic/FileManager] Propagate whether a file 'IsVolatile' to the file ↵Argyrios Kyrtzidis2014-05-051-3/+6
| | | | | | | | | opening functions. Needs llvm r208007. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208008 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-071-2/+2
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203279 91177308-0d34-0410-b5e6-96231b3b80d8
* Change OwningPtr::take() to OwningPtr::release().Ahmed Charles2014-03-071-6/+6
| | | | | | This is a precursor to moving to std::unique_ptr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203275 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply fixed "Honour 'use-external-names' in FileManager"Ben Langmuir2014-02-281-1/+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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202539 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Honour 'use-external-names' in FileManager"Ben Langmuir2014-02-271-1/+1
| | | | | | Revert r202442, which broke the buildbots. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202443 91177308-0d34-0410-b5e6-96231b3b80d8
* Honour 'use-external-names' in FileManagerBen Langmuir2014-02-271-1/+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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202442 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r202420 hopefully fixed for other STLsBen Langmuir2014-02-271-48/+12
| | | | | | | Keep the copy constructor around, and add a FIXME that we should really remove it as soon as we have C++11 std::map's emplace function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202439 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Remove constructors from FileEntry that prevent owning resources"Ben Langmuir2014-02-271-12/+48
| | | | | | This reverts commit r202420, which broke the build. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202421 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove constructors from FileEntry that prevent owning resourcesBen Langmuir2014-02-271-48/+12
| | | | | | | | | | | | | This cleans up some constructors that would not be safe once FileEntry owns the storage for its name. These were already suspect, since they wouldn't work if the FileEntry had an open file descriptor. The only user for these constructors was in UniqueFileContainer, which wasn't a very useful abstraction anyway. So it and UniqueDirContainer have been replaced with std::map<UniqueID, *>. This change should not affect anything outside the FileManager. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202420 91177308-0d34-0410-b5e6-96231b3b80d8
* Split FileEntry name vs. isValidBen Langmuir2014-02-271-2/+3
| | | | | | | This is a small bit of refactoring in preparation for FileEntry owning the storage for its own name. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202412 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix gcc -Wparentheses warning.Patrik Hagglund2014-02-211-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201840 91177308-0d34-0410-b5e6-96231b3b80d8