Commit Graph

18 Commits

Author SHA1 Message Date
David Blaikie 23430ccb04 unique_ptr-ify FileSystemStatCache::setNextStatCache
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
2014-08-11 21:29:24 +00:00
Benjamin Kramer 46741758c1 Update unit test for signature change.
llvm-svn: 212545
2014-07-08 16:07:39 +00:00
Craig Topper 416fa34b87 [C++11] Use 'nullptr'. Unittests edition.
llvm-svn: 210423
2014-06-08 08:38:12 +00:00
Alp Toker 1d257e1d0a Remove the last remaining llvm/Config/config.h includes
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
2014-06-04 03:28:55 +00:00
Hans Wennborg 501eadb429 Check for LLVM_ON_WIN32 instead of _WIN32.
This is a follow-up to r203624 to address Anton's comment.

llvm-svn: 203668
2014-03-12 16:07:46 +00:00
Ben Langmuir d066d4c849 Reapply fixed "Honour 'use-external-names' in FileManager"
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-28 21:16:07 +00:00
Ben Langmuir 1b8d44f59b Revert "Honour 'use-external-names' in FileManager"
Revert r202442, which broke the buildbots.

llvm-svn: 202443
2014-02-27 23:48:03 +00:00
Ben Langmuir 09e0d5c1bb Honour 'use-external-names' in FileManager
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-27 23:27:54 +00:00
Ben Langmuir c8130a74f4 Recommit virtual file system
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-20 21:59:23 +00:00
Juergen Ributzka a32575e4f6 Reverting the virtual file system implementation, because it triggers an assertion
in our internal build bots.

This reverts commits 201618, 201635, 201636, 201639, 201685, 201691, and 201696.

llvm-svn: 201755
2014-02-20 05:24:58 +00:00
Ben Langmuir 090610d37a Initial implementation of virtual file system
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
2014-02-19 00:10:30 +00:00
Rafael Espindola f8f91b8976 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.

llvm-svn: 187619
2013-08-01 21:42:11 +00:00
Rafael Espindola ee30546c00 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!

llvm-svn: 187359
2013-07-29 15:47:24 +00:00
Argyrios Kyrtzidis 3b7793797f 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.

llvm-svn: 169831
2012-12-11 07:48:23 +00:00
Chandler Carruth 320d9666ee Sort the #include lines for unittests/...
I've tried to place sensible headers at the top as main-module headers.

llvm-svn: 169243
2012-12-04 09:45:34 +00:00
NAKAMURA Takumi 7d7d1afeb7 unittests/Basic/FileManagerTest.cpp: Suppress warnings on gcc.
llvm-svn: 140364
2011-09-23 01:53:05 +00:00
NAKAMURA Takumi 67677898d3 unittests/Basic/FileManagerTest.cpp: Unbreak Win32, mingw and msvc.
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
2011-06-24 14:10:29 +00:00
Zhanyong Wan bc402abcc9 Moves FileManagerTest.cpp to unittests/Basic such that the unit test
directory structure matches the library structure.  Reviewed by jyasskin.

llvm-svn: 125600
2011-02-15 21:30:27 +00:00