History log of /external/clang/lib/Basic/FileManager.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ef8225444452a1486bd721f3285301fe84643b00 21-Jul-2014 Stephen Hines <srhines@google.com> Update Clang for rebase to r212749.

This also fixes a small issue with arm_neon.h not being generated always.

Includes a cherry-pick of:
r213450 - fixes mac-specific header issue
r213126 - removes a default -Bsymbolic on Android

Change-Id: I2a790a0f5d3b2aab11de596fc3a74e7cbc99081d
/external/clang/lib/Basic/FileManager.cpp
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 29-May-2014 Stephen Hines <srhines@google.com> Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
/external/clang/lib/Basic/FileManager.cpp
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
/external/clang/lib/Basic/FileManager.cpp
0fda0f75f053ad9afdb2bb8d4ea72c5e6a49d657 01-Aug-2013 Rafael Espindola <rafael.espindola@gmail.com> Use llvm::sys::fs::UniqueID for windows and unix.

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187619 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
aefb1d3312a63ac8d289a2e84747fe61a7f61823 29-Jul-2013 Rafael Espindola <rafael.espindola@gmail.com> Convert a use of stat with sys::fs::status.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187364 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
146d57fd5135a134bcdaaf402157c070cde9e4a1 29-Jul-2013 Rafael Espindola <rafael.espindola@gmail.com> Fix handling of "clang c:foo"

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!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187359 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
09d19efaa147762f84aed55efa7930bb3616a4e5 04-Jul-2013 Craig Topper <craig.topper@gmail.com> Use SmallVectorImpl instead of SmallVector for iterators and references to avoid specifying the vector size unnecessarily.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185610 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
adeb7822cb7947194fef0e12d2d6583ccb8240b5 26-Jan-2013 Dmitri Gribenko <gribozavr@gmail.com> <limits.h> includes <linux/limits.h> on Linux, no need to special-case it


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
713b7c011869f177dc76e6df4f7f44b1bd073bb0 26-Jan-2013 Douglas Gregor <dgregor@apple.com> Since we're stuck with realpath for the header <-> module mapping,
factor the realpath calls into FileManager::getCanonicalName() so we
can cache the results of this epically slow operation. 5% speedup on
my modules test, and realpath drops out of the profile.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173542 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
e5d30e3b403539b10aaa52f03875a2243bf88904 11-Dec-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Extend stat query APIs to explicitly specify if the query is for
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169831 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
55fc873017f10f6f566b182b70f6fc22aefa3464 04-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169237 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
6a1f49423baf6fa0358f396f0d926a3263cb5ff9 06-Nov-2012 Daniel Dunbar <daniel@zuster.org> Basic: Windows doesn't define S_IFIFO.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167468 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
ce36ecd5a509af8fc5924d21694df36e8bc94a95 05-Nov-2012 Daniel Dunbar <daniel@zuster.org> Frontend: Add support for reading named pipes as the main file.

- The whole {File,Source}Manager is built around wanting to pre-determine the
size of files, so we can't fit this in naturally. Instead, we handle it like
we do STDIN, where we just replace the main file contents upfront.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167419 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
98be86038b1e891a05583061c55dfa974150eb2c 31-Jul-2012 Manuel Klimek <klimek@google.com> Fixes a segfault in Tooling when using pch's:
Clear the FileManager's stat cache in between running
translation units, as the stat cache loaded from a pch
is only valid for one compiler invocation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161047 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
ff398965a5abfaf5bc47bc022876f56a28e5b9a7 11-Jul-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce a flag in SourceManager to treat non-system source files
as "volatile", meaning there's a high enough chance that they may
change while we are trying to use them.

This flag is only enabled by libclang.
Currently "volatile" source files will be stat'ed immediately
before opening them, because the file size stat info
may not be accurate since when we got it (e.g. from the PCH).
This avoids crashes when trying to reference mmap'ed memory
from a file whose size is not what we expect.

Note that there's still a window for a racing issue to occur
but the window for it should be way smaller than before.
We can consider later on to avoid mmap completely on such files.

rdar://11612916

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160074 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
be779598aa70a71c56e5d576947ade53e249c602 11-Jul-2012 Axel Naumann <Axel.Naumann@cern.ch> LLVM_ON_WIN32 case: use the proper key in the UniqueFiles map.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160041 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
5ba0559f2f0ddd62de16547af514dbaf93b79585 10-Jul-2012 Axel Naumann <Axel.Naumann@cern.ch> Improve r159256 following Chandler's comments:
Implement UniqueFileContainer::erase(), camelCase, add comment on future optimizations of the cache versus de-optimizations of invalidations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159997 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
446ba14432b68e5d37472180fcd4d8144207c5c5 27-Jun-2012 Axel Naumann <Axel.Naumann@cern.ch> Fix for r159256 on Windows.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159262 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
3ce42c37b0ef6b10538f5040a33d19a6e6988d05 27-Jun-2012 Axel Naumann <Axel.Naumann@cern.ch> From Vassil Vassilev:
add interface for removing a FileEntry from the cache.
Forces a re-read the contents from disk, e.g. because a tool (like cling) wants to pick up a modified file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159256 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
759a4b40cab9dd04683a548f998ebe2e443ca6b4 16-Jun-2012 NAKAMURA Takumi <geek4civic@gmail.com> clang/lib/Basic/FileManager.cpp: Detect the root directory with PathV2. It should be better fix for PR10331, or, "clang X:\foo.c" fails.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158596 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
d3e8eda9a685e95c29ccea52977c0e32a422e563 15-Jun-2012 James Dennett <jdennett@google.com> Documentation cleanup: delete doc comments from source files where they are
broken duplicates of comments that are in the corresponding header files.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158550 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
d54dff026b02303a35147224de72bb44cbb53c79 03-May-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] When validating that the files coming from PCH did not change, also
validate that we didn't override the contents of any of such files.

If this is detected, emit a diagnostic error and recover gracefully
by using the contents of the original file that the PCH was built from.

Part of rdar://11305263

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156107 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
f7ccbad5d9949e7ddd1cbef43d482553b811e026 05-Feb-2012 Dylan Noblesmith <nobled@dreamwidth.org> Basic: import SmallString<> into clang namespace

(I was going to fix the TODO about DenseMap too, but
that would break self-host right now. See PR11922.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149799 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
6f42b62b6194f53bcbc349f5d17388e1936535d7 05-Feb-2012 Dylan Noblesmith <nobled@dreamwidth.org> Basic: import OwningPtr<> into clang namespace

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149798 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
1770e0dadcab966990cca4d7516253c886fd907c 22-Dec-2011 Dylan Noblesmith <nobled@dreamwidth.org> remove unneeded config.h includes



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147195 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
678a3ead409516d8e24831297b9a3bb98f6217c3 17-Nov-2011 NAKAMURA Takumi <geek4civic@gmail.com> Revert r132539 for now, "My testing shows that function stat has no problem with trailing separators. (tested on Windows and Darwin)."

It caused PR10331. MSVCRT stat() cannot strip trailing '/'. (can '\')

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144884 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
90c7892b699c5405a81bcc339432ba2f4b50e0d6 06-Nov-2011 Benjamin Kramer <benny.kra@googlemail.com> Use StringRef's case transformation methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143889 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
6e975c4517958bcc11c834336d340797356058db 14-Sep-2011 Douglas Gregor <dgregor@apple.com> For modules, use a hash of the compiler version, language options, and
target triple to separate modules built under different
conditions. The hash is used to create a subdirectory in the module
cache path where other invocations of the compiler (with the same
version, language options, etc.) can find the precompiled modules.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139662 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
21cae2059a06f7d89eee169409c9266def1b1aca 13-Sep-2011 Douglas Gregor <dgregor@apple.com> When an import statement fails to find a module in the module cache,
but there is a corresponding umbrella header in a framework, build the
module on-the-fly so it can be immediately loaded at the import
statement. This is very much proof-of-concept code, with details to be
fleshed out over time.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139558 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
5f9e272e632e951b1efe824cd16acb4d96077930 23-Jul-2011 Chris Lattner <sabre@nondot.org> remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
fe87b824477bce3a0c3bf2a8d0e949f0249f9a29 03-Jun-2011 Francois Pichet <pichet2000@gmail.com> My testing shows that function stat has no problem with trailing separators. (tested on Windows and Darwin).

This fixes a bug on Windows:
clang c:\test.cpp

Here the call stat("c:") is not recognized as a directory (must be "c:\").

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132539 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
7dbafb3ade491a41100c97597209455ee10c537d 18-Mar-2011 Anders Carlsson <andersca@mac.com> Add FileManager::getNoncachedStatValue, which will resolve relative paths against the working directory specified in the file system options.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127893 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
3cd0128ce49abe658d1858c541e836e57959e04a 16-Mar-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Having FileManager::getFile always open the file, brought much consternation and leaking of file descriptors.

Add 'openFile' bool to FileManager::getFile to specify whether we want to have the file opened or not, have it
false by default, and enable it only in HeaderSearch.cpp where the open+fstat optimization matters.

Fixes rdar://9139899.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127748 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
a8d530e3ad52cca33a81185ccc9518eab23ddb11 15-Mar-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Stop leaking file descriptors.

After the open+fstat optimization, files were already opened for FileManager::getBufferForFile() and we closed them after reading them.
The problem was that when -working-directory was passed, the code path that actually reuses & closes the already opened file descriptor
was not followed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127639 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
2e2468e2d2ccbb9a38fe3b6b754009af7e5d39a9 14-Mar-2011 Anders Carlsson <andersca@mac.com> Get rid of the static FileManager::FixupRelativePath.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127573 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
03fd362dbf6fcd077df566fe2ac3165be668323b 07-Mar-2011 Anders Carlsson <andersca@mac.com> Check in the implementation as well...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127144 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
af036a6c25f540a9daf51e721485ae6d0e645bd8 06-Mar-2011 Anders Carlsson <andersca@mac.com> Convert FileManager::FixupRelativePath over to using PathV2.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127133 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
21af8878b96ab1f9b077407ca3c512e5dc5d0ad6 11-Feb-2011 Zhanyong Wan <wan@google.com> Uses llvm::sys::path instead of hand-rolled algorithm in FileManager.
Reviewed by dgregor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125407 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
9b555ea217565ac0f8bf7255b29496916cb03476 11-Feb-2011 Zhanyong Wan <wan@google.com> Improves Clang's virtual file handling.

This patch contains:

- making some of the existing comments more accurate in the presence
of virtual files/directories.

- renaming some private data members of FileManager to match their roles better.

- creating 'DirectorEntry's for the parent directories of virtual
files, such that we can tell whether two virtual files are from the
same directory. This is useful for injecting virtual files whose
directories don't exist in the real file system.

- minor clean-ups and adding comments for class
FileManager::UniqueDirContainer and FileManager::UniqueFileContainer.

- adding statistics on virtual files to FileManager::PrintStats().

- adding unit tests to verify the existing and new behavior of FileManager.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125384 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
cfbf1c7536e016dc275139dd842d4a5f059a749f 10-Feb-2011 Douglas Gregor <dgregor@apple.com> Implement two related optimizations that make de-serialization of
AST/PCH files more lazy:
- Don't preload all of the file source-location entries when reading
the AST file. Instead, load them lazily, when needed.
- Only look up header-search information (whether a header was already
#import'd, how many times it's been included, etc.) when it's needed
by the preprocessor, rather than pre-populating it.

Previously, we would pre-load all of the file source-location entries,
which also populated the header-search information structure. This was
a relatively minor performance issue, since we would end up stat()'ing
all of the headers stored within a AST/PCH file when the AST/PCH file
was loaded. In the normal PCH use case, the stat()s were cached, so
the cost--of preloading ~860 source-location entries in the Cocoa.h
case---was relatively low.

However, the recent optimization that replaced stat+open with
open+fstat turned this into a major problem, since the preloading of
source-location entries would now end up opening those files. Worse,
those files wouldn't be closed until the file manager was destroyed,
so just opening a Cocoa.h PCH file would hold on to ~860 file
descriptors, and it was easy to blow through the process's limit on
the number of open file descriptors.

By eliminating the preloading of these files, we neither open nor stat
the headers stored in the PCH/AST file until they're actually needed
for something. Concretely, we went from

*** HeaderSearch Stats:
835 files tracked.
364 #import/#pragma once files.
823 included exactly once.
6 max times a file is included.
3 #include/#include_next/#import.
0 #includes skipped due to the multi-include optimization.
1 framework lookups.
0 subframework lookups.

*** Source Manager Stats:
835 files mapped, 3 mem buffers mapped.
37460 SLocEntry's allocated, 11215575B of Sloc address space used.
62 bytes of files mapped, 0 files with line #'s computed.

with a trivial program that uses a chained PCH including a Cocoa PCH
to

*** HeaderSearch Stats:
4 files tracked.
1 #import/#pragma once files.
3 included exactly once.
2 max times a file is included.
3 #include/#include_next/#import.
0 #includes skipped due to the multi-include optimization.
1 framework lookups.
0 subframework lookups.

*** Source Manager Stats:
3 files mapped, 3 mem buffers mapped.
37460 SLocEntry's allocated, 11215575B of Sloc address space used.
62 bytes of files mapped, 0 files with line #'s computed.

for the same program.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125286 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
100f239df90c2576cfd6ce4fdcf3886033c00e26 08-Feb-2011 Rafael Espindola <rafael.espindola@gmail.com> Update for API change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125129 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
8ef6c8cb6c5627240e2339fd7062c9873f821d7e 05-Feb-2011 Douglas Gregor <dgregor@apple.com> Improve our uniquing of file entries when files are re-saved or are
overridden via remapping. Thus, when we create a "virtual" file in the
file manager, we still stat() the real file that lives behind it so
that we can provide proper uniquing based on inodes. This helps keep
the file manager much more consistent.

To take advantage of this when reparsing files in libclang, we disable
the use of the stat() cache when reparsing or performing code
completion, since the stat() cache is very likely to be out of date in
this use case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124971 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
50ae3e3f10ccbb8c04c9ea941d930973ccf231bd 03-Feb-2011 Rafael Espindola <rafael.espindola@gmail.com> Revert 124754 and 124760 as they made clang unusable in the presence of symbolic
links.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124776 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
b9d4cb38815fd2173a9f0512dfe2024d61bbcec7 03-Feb-2011 Douglas Gregor <dgregor@apple.com> Improve the performance of filename canonicalization by avoiding
redundant searches in the string. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124760 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
aa596e877062ddd45d65705622a58587c5ba54b6 02-Feb-2011 Douglas Gregor <dgregor@apple.com> Canonicalize path names in the file manager before performing a lookup
on that name. Canonicalization eliminates silliness such as "." and
"foo/.." that breaks the uniquing of files in the presence of virtual
files or files whose inode numbers have changed during
parsing/re-parsing. c-index-test isn't able to create this crazy
situation, so I've resorted to testing outside of the Clang
tree. Fixes <rdar://problem/8928220>.

Note that this hackery will go away once we have a real virtual file
system on which we can layer FileManager; the virtual-files hack is
showing cracks.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124754 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
04331169f04198eb769925fa17696a21989c9d8b 27-Jan-2011 Axel Naumann <Axel.Naumann@cern.ch> TextDiagnosticPrinter.cpp: Show diagnostics as far as possible even with invalid PresomedLoc, instead of just silencing it.

FileManager.cpp: Allow virtual files in nonexistent directories.
FileManager.cpp: Close FileDescriptor for virtual files that correspond to actual files.
FileManager.cpp: Enable virtual files to be created even for files that were flagged as NON_EXISTENT_FILE, e.g. by a prior (unsuccessful) addFile().

ASTReader.cpp: Read a PCH even if the original source files cannot be found.

Add a test for reading a PCH of a file that has been removed and diagnostics referencing that file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124374 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
fbfd180495e7800975c6d9bdc6d24e706ef70e34 21-Dec-2010 Michael J. Spencer <bigcheesegs@gmail.com> Replace all uses of PathV1::makeAbsolute with PathV2::fs::make_absolute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122340 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
256053b31e697fdf0cc48f17d621c82fc3b8dff0 17-Dec-2010 Michael J. Spencer <bigcheesegs@gmail.com> Replace all uses of PathV1::isAbsolute with PathV2::is_{absolute,relative}.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122087 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
4eeebc464e1f968d9968a4786c82558f18ac2ed8 16-Dec-2010 Michael J. Spencer <bigcheesegs@gmail.com> MemoryBuffer API update.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121956 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
3a321e23f66128dbb986343927456ff6702af617 09-Dec-2010 Michael J. Spencer <bigcheesegs@gmail.com> Use error_code instead of std::string* for MemoryBuffer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121378 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
c0f31fd08537b65ad92db8ce860747e3402a07e6 02-Dec-2010 Chris Lattner <sabre@nondot.org> attempt to fix a buildbot failure, apparently apache fails to build.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120688 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
03013fa9a0bf1ef4b907f5fec006c8f4000fdd21 29-Nov-2010 Michael J. Spencer <bigcheesegs@gmail.com> Merge System into Support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120297 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
5cc1c738b0c51af55cbfe7672c284c19f8e30eb2 23-Nov-2010 Chris Lattner <sabre@nondot.org> The final result of all this refactoring: instead of doing stat immediately
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120066 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
291fcf02980be85cf13c8a63bb036a19012311df 23-Nov-2010 Chris Lattner <sabre@nondot.org> hopefully resolve the windows buildbot issue (retch)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120061 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
898a061f69e1145bf89a987c08203132b9922a3c 23-Nov-2010 Chris Lattner <sabre@nondot.org> change the 'is directory' indicator to be a null-or-not
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120060 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
f9f7766846a205bc900b578f944567e679b221aa 23-Nov-2010 Chris Lattner <sabre@nondot.org> pull "is directory" handling into FileManager::getStatValue
which simplifies clients and is important for future directions.
Add a FD member to FileEntry which isn't used but will be shortly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120056 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
f3e8a9961d000fb9e093593b6a1bf72313b90d06 23-Nov-2010 Chris Lattner <sabre@nondot.org> tidy up code, add a comment about dir caching.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120048 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
11aa4b03b054cb9d3c201bba5632241145865e29 23-Nov-2010 Chris Lattner <sabre@nondot.org> factor the "cache miss" handling code out of FM into a static
method in FileSystemStatCache.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120037 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
f8f6129861f3972dab2c5a6cde29711ac780a7d0 23-Nov-2010 Chris Lattner <sabre@nondot.org> r120013 dropped passing in the precomputed file size to
MemoryBuffer::getFile, causing us to pick up a fstat for
every file. Restore the optimization.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120032 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
10e286aa8d39fb51a21412850265d9dae74613ee 23-Nov-2010 Chris Lattner <sabre@nondot.org> rework the stat cache, pulling it out of FileManager.h into
its own header and giving it some more structure. No
functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120030 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
75dfb65c38d51772df9a00ce2d2feeefd55667ad 23-Nov-2010 Chris Lattner <sabre@nondot.org> tidy up. Split FileManager::getBufferForFile into
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120013 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
39b49bcaaddb1049234fca9500c0ac02c088e23d 23-Nov-2010 Chris Lattner <sabre@nondot.org> now the FileManager has a FileSystemOpts ivar, stop threading
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120010 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
7ad97ffa631af6ad678c79b38341ac995f347ce9 23-Nov-2010 Chris Lattner <sabre@nondot.org> give FileManager a 'FileSystemOptions' ivar, which will be used
to simplify a bunch of code in it. It should ultimately get inlined
into FileManager.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120007 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
151466a18671df9cfd9abd59ba53df35b1d687da 23-Nov-2010 Chris Lattner <sabre@nondot.org> Partially revert Doug's PCH validation patch (r98585).

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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120001 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
67452f51aec1ad8a3e4c6622c0c57c5d8dc1b6a3 23-Nov-2010 Chris Lattner <sabre@nondot.org> stringref'ize API


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119997 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
efc4be242b8c8f076ad4addd3598c4853ec50ac7 23-Nov-2010 Chris Lattner <sabre@nondot.org> avoid creating sys::Path instances when -fworking-directory isn't being used.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119995 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
aa8b2d95bc108e8f3a443e4a936e1ed8a3cc1cc6 21-Nov-2010 Benjamin Kramer <benny.kra@googlemail.com> Filename.rfind("/\\") won't give us the position of the last directory seperator.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119939 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
f69a1f319bd3c846c4a9ab84ea615e4e37dfd359 21-Nov-2010 Chris Lattner <sabre@nondot.org> change the various getFile routines to use StringRef as their implementation form.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119934 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
389db16c63eec6ecfa9b235155252d8da766e94e 03-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Implement -working-directory.

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118203 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
c070da46b896940aa2cbac416e5a2f8eee22d7d8 24-Aug-2010 Chris Lattner <sabre@nondot.org> fix PR7953 - Windows filename are case insensitive:

#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!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111866 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
3e15e0a7b4da6d906357b00b1bd2bba5ec3195ed 27-Jul-2010 Douglas Gregor <dgregor@apple.com> When remapping a virtual file, also make an entry for the file with
its absolute path on disk. Also, introduce a fun test for the
precompiled preamble, which almost works...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109470 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
ec1b1cc006cef19e0a95d0ea6fbfd37d0d615066 15-Jul-2010 Benjamin Kramer <benny.kra@googlemail.com> Pass StringRefs by value.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108375 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
9a6ac540bab63380a4a78d8fad87f23c50878685 18-Dec-2009 John Thompson <John.Thompson.JTSoftware@gmail.com> Removing trailing directory separator, to make stat work

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91684 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
475ddb4547ce35706ce1ff54b14bdcfdc51954c2 11-Dec-2009 Daniel Dunbar <daniel@zuster.org> FileManager: Do not cache failed stats, it is easy to construct common
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91082 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
057e567f1b375190779e5341f42861896cdee442 02-Dec-2009 Douglas Gregor <dgregor@apple.com> Extend -remap-file=from;to to permit mapping from a non-existent
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90329 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
52e7108f51a4a9f4d6e84f33fb594d06e1d79560 16-Oct-2009 Douglas Gregor <dgregor@apple.com> Add support for a chain of stat caches in the FileManager, rather than
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84263 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
f1affe6129442b230d3d09b1938e07a7b341a102 18-Sep-2009 Chris Lattner <sabre@nondot.org> don't stick an uninitialized 'stat' buf into the stat cache, fill it
with zeros. This avoids a GCC warning (PR5000)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82194 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
1eb4433ac451dc16f4133a88af2d002ac26c58ef 09-Sep-2009 Mike Stump <mrs@apple.com> Remove tabs, and whitespace cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
458fb10ef5ba2d7b375c6c64095c1458af0a5be3 05-Sep-2009 Benjamin Kramer <benny.kra@googlemail.com> Replace some instances of std::string with StringRefs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81079 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
d57a7ef9252964bc6c8471451d7bd395b0520cb8 24-Aug-2009 Chris Lattner <sabre@nondot.org> API changes to match llvm ToT.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79868 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
6cb7c1a43b0c8f739d1f54b7fdae5ede86033496 23-Aug-2009 Benjamin Kramer <benny.kra@googlemail.com> Replace cerr with errs().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79854 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
46730b261c46765c51a9aa83c2571a2a8705482a 12-Aug-2009 Chris Lattner <sabre@nondot.org> improve path handling, patch by Baptiste Lepilleur!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78824 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
4fed3f47f6b9e31d603c5c2d1f6d8ec2e1241e57 27-Apr-2009 Douglas Gregor <dgregor@apple.com> Implement caching of stat() calls for precompiled headers, which is
essentially the same thing we do with pretokenized headers. stat()
caching improves performance of the Cocoa-prefixed "Hello, World" by
45%.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70223 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
370187c8a3e96517c943329f2511737a04b85450 22-Apr-2009 Douglas Gregor <dgregor@apple.com> Remove the serialization code that predates precompiled
headers. Future approaches to (de-)serializing ASTs will be based on
the PCH infrastructure.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69828 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
96438f319bb07d9a40564b5e01333f82c0c8a61e 12-Feb-2009 Ted Kremenek <kremenek@apple.com> FileManager:
- 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)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64351 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
3102c83f6eac0cbbd698471173672c3e47a6914c 12-Feb-2009 Chris Lattner <sabre@nondot.org> search and replaceo?


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64348 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
fc7052d4a241ee6fc70afea7c1c9560147f0a49c 12-Feb-2009 Ted Kremenek <kremenek@apple.com> Add lightweight shim "clang::StatSysCallCache" that caches 'stat' system calls
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64345 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
75368893339d89f6523c312b0a0eb23d438b6dff 28-Jan-2009 Ted Kremenek <kremenek@apple.com> On Windows use a BumpPtrAllocator for the UniqueFileContainer's StringMap.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63162 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
f3eb9219cf4b4e80c377d37aed72d5d6d840b7bc 28-Jan-2009 Ted Kremenek <kremenek@apple.com> FileManager: Use a BumpPtrAllocator for the StringMaps DirEntries and FileEntries.

Performance impact (clang -fsyntax-only INPUTS/Cocoa_h.m):
non-PTH: 0.4% improvement
PTH: 0.8% improvement



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63159 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
cb8d58b82859d2c56b679b901de38f416e2b6f48 28-Jan-2009 Ted Kremenek <kremenek@apple.com> Add a some comments to designate Windows-specific/Unix-specific code. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63157 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp
bda0b626e74513950405c27525af87e214e605e2 16-Mar-2008 Chris Lattner <sabre@nondot.org> Make a major restructuring of the clang tree: introduce a top-level
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48402 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/FileManager.cpp