summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/FileManager.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Replace all uses of PathV1::makeAbsolute with PathV2::fs::make_absolute.Michael J. Spencer2010-12-211-3/+4
| | | | llvm-svn: 122340
* Replace all uses of PathV1::isAbsolute with PathV2::is_{absolute,relative}.Michael J. Spencer2010-12-171-4/+5
| | | | llvm-svn: 122087
* MemoryBuffer API update.Michael J. Spencer2010-12-161-19/+18
| | | | llvm-svn: 121956
* Use error_code instead of std::string* for MemoryBuffer.Michael J. Spencer2010-12-091-8/+27
| | | | llvm-svn: 121378
* attempt to fix a buildbot failure, apparently apache fails to build.Chris Lattner2010-12-021-1/+1
| | | | llvm-svn: 120688
* Merge System into Support.Michael J. Spencer2010-11-291-1/+1
| | | | llvm-svn: 120297
* The final result of all this refactoring: instead of doing stat immediatelyChris Lattner2010-11-231-3/+16
| | | | | | | | | | | | | 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
* hopefully resolve the windows buildbot issue (retch)Chris Lattner2010-11-231-0/+8
| | | | llvm-svn: 120061
* change the 'is directory' indicator to be a null-or-notChris Lattner2010-11-231-14/+19
| | | | | | | | | 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
* pull "is directory" handling into FileManager::getStatValueChris Lattner2010-11-231-29/+36
| | | | | | | which simplifies clients and is important for future directions. Add a FD member to FileEntry which isn't used but will be shortly. llvm-svn: 120056
* tidy up code, add a comment about dir caching.Chris Lattner2010-11-231-20/+16
| | | | llvm-svn: 120048
* factor the "cache miss" handling code out of FM into a static Chris Lattner2010-11-231-21/+6
| | | | | | method in FileSystemStatCache. llvm-svn: 120037
* r120013 dropped passing in the precomputed file size to Chris Lattner2010-11-231-2/+3
| | | | | | | MemoryBuffer::getFile, causing us to pick up a fstat for every file. Restore the optimization. llvm-svn: 120032
* rework the stat cache, pulling it out of FileManager.h intoChris Lattner2010-11-231-35/+39
| | | | | | | its own header and giving it some more structure. No functionality change. llvm-svn: 120030
* tidy up. Split FileManager::getBufferForFile intoChris Lattner2010-11-231-6/+14
| | | | | | | | | | two copies, since they are fundamentally different operations and the StringRef one should go away (it shouldn't be part of FileManager at least). Remove some dead arguments. llvm-svn: 120013
* now the FileManager has a FileSystemOpts ivar, stop threadingChris Lattner2010-11-231-15/+8
| | | | | | | | | FileSystemOpts through a ton of apis, simplifying a lot of code. This also fixes a latent bug in ASTUnit where it would invoke methods on FileManager without creating one in some code paths in cindextext. llvm-svn: 120010
* give FileManager a 'FileSystemOptions' ivar, which will be usedChris Lattner2010-11-231-7/+7
| | | | | | | to simplify a bunch of code in it. It should ultimately get inlined into FileManager. llvm-svn: 120007
* Partially revert Doug's PCH validation patch (r98585).Chris Lattner2010-11-231-5/+3
| | | | | | | | | | | | | | | | | | | | | | This patch completely defeated the "passing in a prestat'd size to MemoryBuffer" optimization, leading to an extra fstat call for every buffer opened, in order to find out if the datestamp and size of the file on disk matches what is in the stat cache. I fully admit that I don't completely understand what is going on here: why punish code when a stat cache isn't in use? what is the point of a stat cache if you have to turn around and stat stuff to validate it? To resolve both these issues, just drop the modtime check and check the file size, which is the important thing anyway. This should also resolve PR6812, because presumably windows is stable when it comes to file sizes. If the modtime is actually important, we should get it and keep it on the first stat. This eliminates 833 fstat syscalls when processing Cocoa.h, speeding up system time on -Eonly Cocoa.h from 0.041 to 0.038s. llvm-svn: 120001
* stringref'ize APIChris Lattner2010-11-231-18/+16
| | | | llvm-svn: 119997
* avoid creating sys::Path instances when -fworking-directory isn't being used.Chris Lattner2010-11-231-1/+8
| | | | llvm-svn: 119995
* Filename.rfind("/\\") won't give us the position of the last directory ↵Benjamin Kramer2010-11-211-11/+11
| | | | | | seperator. llvm-svn: 119939
* change the various getFile routines to use StringRef as their implementation ↵Chris Lattner2010-11-211-37/+32
| | | | | | form. llvm-svn: 119934
* Implement -working-directory.Argyrios Kyrtzidis2010-11-031-11/+49
| | | | | | | | | | | | | | | | | | | When -working-directory is passed in command line, file paths are resolved relative to the specified directory. This helps both when using libclang (where we can't require the user to actually change the working directory) and to help reproduce test cases when the reproduction work comes along. --FileSystemOptions is introduced which controls how file system operations are performed (currently it just contains the working directory value if set). --FileSystemOptions are passed around to various interfaces that perform file operations. --Opening & reading the content of files should be done only through FileManager. This is useful in general since file operations will be abstracted in the future for the reproduction mechanism. FileSystemOptions is independent of FileManager so that we can have multiple translation units sharing the same FileManager but with different FileSystemOptions. Addresses rdar://8583824. llvm-svn: 118203
* fix PR7953 - Windows filename are case insensitive:Chris Lattner2010-08-231-0/+4
| | | | | | | | | | | | | | | | #pragma once wasn't working on win32 if the header file was included using a different case. I tracked down the problem to the fact that clang::FileManager was caching files using case sensitive string (UniqueFiles) on Windows. I changed FileManager to cache filename in lower case only. Doesn't affect UNIX because UNIX uses Inode to uniquely identify files. unix doesn't use this codepath. Analysis and patch by Francois Pichet! llvm-svn: 111866
* When remapping a virtual file, also make an entry for the file withDouglas Gregor2010-07-261-0/+12
| | | | | | | its absolute path on disk. Also, introduce a fun test for the precompiled preamble, which almost works... llvm-svn: 109470
* Pass StringRefs by value.Benjamin Kramer2010-07-141-2/+2
| | | | llvm-svn: 108375
* Removing trailing directory separator, to make stat workJohn Thompson2009-12-181-0/+5
| | | | llvm-svn: 91684
* FileManager: Do not cache failed stats, it is easy to construct commonDaniel Dunbar2009-12-111-10/+9
| | | | | | | | | | | | | | | | | | inconsistent situations if we do, and they are not important for PCH performance (which currently only needs the stats to construct the initial FileManager entries). - No test case, sorry, the machinations are too involved. This occurs when, for example, the build makes a PCH file and has a header map or a -I for a directory that does not yet exist. It is possible we will cache the negative stat on that directory, and then in the build we will never find header files inside that dir. For PCH we don't need these stats anyway for performance, so this also makes PCH files smaller w/ no loss. I hope to eventually eliminate the stat cache entirely. llvm-svn: 91082
* Extend -remap-file=from;to to permit mapping from a non-existentDouglas Gregor2009-12-021-22/+73
| | | | | | | | | | | | file. This is accomplished by introducing the notion of a "virtual" file into the file manager, which provides a FileEntry* for a named file whose size and modification time are known but which may not exist on disk. Added a cute little test that remaps both a .c file and a .h file it includes to alternative files. llvm-svn: 90329
* Add support for a chain of stat caches in the FileManager, rather thanDouglas Gregor2009-10-161-2/+37
| | | | | | | | | only supporting a single stat cache. The immediate benefit of this change is that we can now generate a PCH/AST file when including another PCH file; in the future, the chain of stat caches will likely be useful with multiple levels of PCH files. llvm-svn: 84263
* don't stick an uninitialized 'stat' buf into the stat cache, fill itChris Lattner2009-09-181-0/+1
| | | | | | with zeros. This avoids a GCC warning (PR5000) llvm-svn: 82194
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-29/+28
| | | | llvm-svn: 81346
* Replace some instances of std::string with StringRefs.Benjamin Kramer2009-09-051-0/+3
| | | | llvm-svn: 81079
* API changes to match llvm ToT.Chris Lattner2009-08-231-0/+1
| | | | llvm-svn: 79868
* Replace cerr with errs().Benjamin Kramer2009-08-231-12/+11
| | | | llvm-svn: 79854
* improve path handling, patch by Baptiste Lepilleur!Chris Lattner2009-08-121-0/+3
| | | | llvm-svn: 78824
* Implement caching of stat() calls for precompiled headers, which isDouglas Gregor2009-04-271-0/+18
| | | | | | | | essentially the same thing we do with pretokenized headers. stat() caching improves performance of the Cocoa-prefixed "Hello, World" by 45%. llvm-svn: 70223
* Remove the serialization code that predates precompiledDouglas Gregor2009-04-221-2/+0
| | | | | | | headers. Future approaches to (de-)serializing ASTs will be based on the PCH infrastructure. llvm-svn: 69828
* FileManager:Ted Kremenek2009-02-121-6/+4
| | | | | | | | | - set the 'StatSysCallCache' object using a setter method instead of FileManager's constructor. This allows the cache to be installed after the FileManager object is created. - Add 'file mode' to FileEntry (useful for stat caching) llvm-svn: 64351
* search and replaceo? Chris Lattner2009-02-121-1/+1
| | | | llvm-svn: 64348
* Add lightweight shim "clang::StatSysCallCache" that caches 'stat' system callsTed Kremenek2009-02-121-8/+10
| | | | | | | | | | for use by FileManager. FileManager now takes a StatSysCallCache* in its constructor (which defaults to NULL). This will be used for evaluating whether or not caching 'stat' system calls in PTH is a performance win. This shim adds no observable performance impact in the case where the 'StatSysCallCache*' is null. llvm-svn: 64345
* On Windows use a BumpPtrAllocator for the UniqueFileContainer's StringMap.Ted Kremenek2009-01-281-1/+1
| | | | llvm-svn: 63162
* FileManager: Use a BumpPtrAllocator for the StringMaps DirEntries and ↵Ted Kremenek2009-01-281-1/+0
| | | | | | | | | | FileEntries. Performance impact (clang -fsyntax-only INPUTS/Cocoa_h.m): non-PTH: 0.4% improvement PTH: 0.8% improvement llvm-svn: 63159
* Add a some comments to designate Windows-specific/Unix-specific code. No ↵Ted Kremenek2009-01-281-0/+12
| | | | | | functionality change. llvm-svn: 63157
* Make a major restructuring of the clang tree: introduce a top-levelChris Lattner2008-03-151-0/+275
lib dir and move all the libraries into it. This follows the main llvm tree, and allows the libraries to be built in parallel. The top level now enforces that all the libs are built before Driver, but we don't care what order the libs are built in. This speeds up parallel builds, particularly incremental ones. llvm-svn: 48402
OpenPOWER on IntegriCloud