Commit Graph

57 Commits

Author SHA1 Message Date
David Blaikie 13156b689e Standardize on StringMap::insert, removing uses of StringMap::GetOrCreateValue.
llvm-svn: 222306
2014-11-19 03:06:06 +00:00
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
David Blaikie 326ffb3683 Improve memory ownership of vfs::Files in the FileSystemStatCache by using std::unique_ptr
Spotted after a memory leak (due to the complexities of manual memory
management) was fixed in 212466.

llvm-svn: 212541
2014-07-08 15:46:02 +00:00
Craig Topper 49a2790fb3 [C++11] Use 'nullptr'. Frontend edition.
llvm-svn: 209389
2014-05-22 04:46:25 +00:00
Justin Bogner 25463f1577 Teach users of OnDiskHashTable to define hash_value and offset types
This paves the way to making OnDiskHashTable work with hashes that are
not 32 bits wide and to making OnDiskHashTable work very large hash
tables. The LLVM change to use these types is upcoming.

llvm-svn: 206640
2014-04-18 20:27:24 +00:00
Justin Bogner bb094f0669 Remove OnDiskHashTable.h, since it's been moved to llvm
llvm-svn: 206637
2014-04-18 19:57:06 +00:00
Justin Bogner e1c147c3cf Reapply "OnDiskHashTable: Use EndianStream.h to write little endian ostreams"
Committed this by accident before it was done last time.

Original message:

    Rather than rolling our own functions to write little endian data
    to an ostream, we can use the support in llvm's EndianStream.h.

    No functional change.

llvm-svn: 205061
2014-03-28 22:03:19 +00:00
Justin Bogner d42773bcc8 Revert "OnDiskHashTable: Use EndianStream.h to write little endian ostreams"
This reverts commit r205044.

llvm-svn: 205047
2014-03-28 20:32:11 +00:00
Justin Bogner a06321efdd OnDiskHashTable: Use EndianStream.h to write little endian ostreams
Rather than rolling our own functions to write little endian data to
an ostream, we can use the support in llvm's EndianStream.h.

No functional change.

llvm-svn: 205044
2014-03-28 20:03:54 +00:00
Craig Topper afa7cb3aa5 [C++11] Add 'override' keyword to virtual methods that override their base class.
llvm-svn: 203758
2014-03-13 06:07:04 +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
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 3a02247dc9 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.

llvm-svn: 169237
2012-12-04 09:13:33 +00:00
Richard Smith 2683b4c0fd Switch PTH format from a 7 byte magic number to an 8 byte one, to avoid
misaligned reads throughout the file. Bump PTH format version to 10.

llvm-svn: 162076
2012-08-17 03:55:43 +00:00
David Blaikie bbafb8a745 Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST).
The member variable is always "LangOpts" and the member function is always "getLangOpts".

Reviewed by Chris Lattner

llvm-svn: 152536
2012-03-11 07:00:24 +00:00
Dylan Noblesmith 2c1dd2716a 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.)

llvm-svn: 149799
2012-02-05 02:13:05 +00:00
Chris Lattner 0e62c1cc0b remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.

llvm-svn: 135852
2011-07-23 10:55:15 +00:00
Jay Foad 9a6b09874d Make more use of llvm::StringRef in various APIs. In particular, don't
use the deprecated forms of llvm::StringMap::GetOrCreateValue().

llvm-svn: 133515
2011-06-21 15:13:30 +00:00
Argyrios Kyrtzidis 11e6f0a6c3 Currently we can only remap a file by creating a MemoryBuffer and replacing the file contents with it.
Allow remapping a file by specifying another filename whose contents should be loaded if the original
file gets loaded. This allows to override files without having to create & load buffers in advance.

llvm-svn: 127052
2011-03-05 01:03:53 +00:00
Peter Collingbourne 2f1e36bfd0 Rename tok::eom to tok::eod.
The previous name was inaccurate as this token in fact appears at
the end of every preprocessing directive, not just macro definitions.
No functionality change, except for a diagnostic tweak.

llvm-svn: 126631
2011-02-28 02:37:51 +00:00
Abramo Bagnara ea4f7c7761 Introduced raw_identifier token kind.
llvm-svn: 122394
2010-12-22 08:23:18 +00:00
Michael J. Spencer 740857fa10 Replace all uses of PathV1::makeAbsolute with PathV2::fs::make_absolute.
llvm-svn: 122340
2010-12-21 16:45:57 +00:00
Michael J. Spencer f28df4cdba Replace all uses of PathV1::isAbsolute with PathV2::is_{absolute,relative}.
llvm-svn: 122087
2010-12-17 21:22:22 +00:00
Michael J. Spencer 8aaf49959c Merge System into Support.
llvm-svn: 120297
2010-11-29 18:12:39 +00:00
Chris Lattner dd278430a3 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.

llvm-svn: 120060
2010-11-23 21:17:56 +00:00
Chris Lattner 8f0583daa2 simplify the cache miss handling code, eliminating CacheMissing.
llvm-svn: 120038
2010-11-23 20:05:15 +00:00
Chris Lattner 226efd356c rework the stat cache, pulling it out of FileManager.h into
its own header and giving it some more structure.  No 
functionality change.

llvm-svn: 120030
2010-11-23 19:19:34 +00:00
Chris Lattner 9795b39113 zap dead code.
llvm-svn: 113074
2010-09-04 18:12:20 +00:00
Ted Kremenek fee882ac95 PTH generation: Don't save the leading '#' token in a null directive. This unbreaks using PTH with Boost (<rdar://problem/8227989>).
llvm-svn: 109484
2010-07-27 02:58:57 +00:00
Chris Lattner fb24a3a4ec push some source location information down through the compiler,
into ContentCache::getBuffer.  This allows it to produce 
diagnostics on the broken #include line instead of without a 
location.

llvm-svn: 101939
2010-04-20 20:35:58 +00:00
Kovarththanan Rajaratnam 5497e49ae4 Make some typedefs private
llvm-svn: 98817
2010-03-18 07:45:30 +00:00
Kovarththanan Rajaratnam 3fd8082ff5 Rename variable to indicate what it is being used for
llvm-svn: 98816
2010-03-18 07:18:10 +00:00
Douglas Gregor 4ad3da2843 Entering the main source file in the preprocessor can fail if the
source file has been changed. Handle that failure more gracefully.

llvm-svn: 98727
2010-03-17 15:44:30 +00:00
Douglas Gregor 874cc62876 Use SourceManager's Diagnostic object for all file-reading errors,
simplifying the SourceManager interfaces somewhat.

llvm-svn: 98598
2010-03-16 00:35:39 +00:00
Kovarththanan Rajaratnam b4c0f5cc79 Add EmitString helper method
llvm-svn: 98488
2010-03-14 08:35:19 +00:00
Kovarththanan Rajaratnam d3fa9721fb Unbreak last commit. This should have been part of r98478.
llvm-svn: 98480
2010-03-14 07:55:43 +00:00
Kovarththanan Rajaratnam fb0762057e Pass file string by reference
llvm-svn: 98478
2010-03-14 07:38:15 +00:00
Kovarththanan Rajaratnam a9c81a8848 Use makeAbsolute()
llvm-svn: 98472
2010-03-14 07:06:50 +00:00
Kovarththanan Rajaratnam b65a14802c Move to anonymous namespace
llvm-svn: 98469
2010-03-14 06:48:05 +00:00
Kovarththanan Rajaratnam e5f1c197af No need to call setIdentifierInfo() after LookUpIdentifierInfo() which LookUpIdentifierInfo() will automatically do
llvm-svn: 98435
2010-03-13 08:53:33 +00:00
Kovarththanan Rajaratnam 7a67f67823 Don't rely on implicit conversion
llvm-svn: 97916
2010-03-07 11:21:46 +00:00
Kovarththanan Rajaratnam 3c36a6669a Use clang::io::Emit8
llvm-svn: 97810
2010-03-05 15:40:54 +00:00
Kovarththanan Rajaratnam daca645655 Move Emit24 to clang::io
llvm-svn: 97569
2010-03-02 17:41:26 +00:00
Mike Stump 281d6d7745 Use the llvm coding convention for indentation for switch.
llvm-svn: 93966
2010-01-20 02:03:14 +00:00
Chris Lattner 710bb87147 Fix PR5633 by making the preprocessor handle the case where we can
stat a file but where mmaping it fails.  In this case, we emit an
error like:
t.c:1:10: fatal error: error opening file '../../foo.h'

instead of "cannot find file".

llvm-svn: 90110
2009-11-30 04:18:44 +00:00
Benjamin Kramer 16634c2c5a Remove VISIBILITY_HIDDEN from anonymous namespaces in libFrontend.
llvm-svn: 90033
2009-11-28 10:07:24 +00:00
Daniel Dunbar 07d0785dbb PR5218: Replace IdentifierInfo::getName with StringRef version, now that clients
are updated.

llvm-svn: 84447
2009-10-18 21:17:35 +00:00