Chris Lattner [Sun, 18 Jan 2009 02:19:16 +0000 (02:19 +0000)]
On i386 and x86-64, just do unaligned loads
instead of assembling from bytes. This speeds up -Eonly PTH reading
of cocoa.h by about 2ms, which is 4.2%.
Chris Lattner [Sun, 18 Jan 2009 01:57:14 +0000 (01:57 +0000)]
switch PTH lexer from using "const char*"s to "const unsigned char*"s
internally. This is just a cleanup that reduces the need to cast to
unsigned char before assembling a larger integer.
Chris Lattner [Sat, 17 Jan 2009 08:45:21 +0000 (08:45 +0000)]
Rename SourceLocation::getFileID to getChunkID, because it returns
the chunk ID not the file ID. This exposes problems in
TextDiagnosticPrinter where it should have been using the canonical
file ID but wasn't. Fix these along the way.
Chris Lattner [Sat, 17 Jan 2009 08:27:52 +0000 (08:27 +0000)]
Change the Lexer ctor used to lex _Pragma directives into a static factory
method. This lets us clean up the interface and make it more obvious that
this method is *really really* _Pragma specific.
Note that _Pragma handling uglifies the Lexer in the critical path. It would
be very interesting to consider making _Pragma remapping be a new special
lexer class of its own.
Chris Lattner [Sat, 17 Jan 2009 06:22:33 +0000 (06:22 +0000)]
this massive patch introduces a simple new abstraction: it makes
"FileID" a concept that is now enforced by the compiler's type checker
instead of yet-another-random-unsigned floating around.
This is an important distinction from the "FileID" currently tracked by
SourceLocation. *That* FileID may refer to the start of a file or to a
chunk within it. The new FileID *only* refers to the file (and its
#include stack and eventually #line data), it cannot refer to a chunk.
FileID is a completely opaque datatype to all clients, only SourceManager
is allowed to poke and prod it.
Chris Lattner [Sat, 17 Jan 2009 03:48:08 +0000 (03:48 +0000)]
Instead of iterating over FileID's, have PTH generation iterate over the
content cache directly. Content cache has a 1-1 mapping with fileentries,
whereas multiple FileIDs can be the same FileEntry.
Douglas Gregor [Sat, 17 Jan 2009 00:42:38 +0000 (00:42 +0000)]
Teach DeclContext how to find the primary declaration for any TagDecl
even when we are still defining the TagDecl. This is required so that
qualified name lookup of a class name within its definition works (see
the new bits in test/SemaCXX/qualified-id-lookup.cpp).
As part of this, move the nested redefinition checking code into
ActOnTag. This gives us diagnostics earlier (when we try to perform
the nested redefinition, rather than when we try to complete the 2nd
definition) and removes some code duplication.
Sebastian Redl [Fri, 16 Jan 2009 23:28:06 +0000 (23:28 +0000)]
Convert some more statement actions to smart pointers.
Fix a type error; parser wanted to pass the third part of a for-statement as a statement; should be expression.
Daniel Dunbar [Fri, 16 Jan 2009 23:12:12 +0000 (23:12 +0000)]
ccc: Clean up (user level) error handling.
- ccc now checks for existence of input files (more annoying to test,
but matches gcc).
- Fix some test cases.
Chris Lattner [Fri, 16 Jan 2009 23:03:56 +0000 (23:03 +0000)]
Make FullSourceLoc derive from SourceLocation instead of
containing one. Containment is generally better than derivation,
but in this case FullSourceLoc really 'isa' SourceLocation.
Daniel Dunbar [Fri, 16 Jan 2009 20:25:36 +0000 (20:25 +0000)]
ccc: Darwin/X86: Implement remainder of (non -Z...) generic argument
translation.
- As is my general strategy, this is initially pedantically
compatible with gcc and can be cleaned up later. So, for example,
we still pass -static to collect2 4 times if you say '-mkernel
-fapple-kext'. ;)
Chris Lattner [Fri, 16 Jan 2009 19:50:11 +0000 (19:50 +0000)]
As a performance optimization, don't bother calling MacroInfo::isIdenticalTo
if warnings in system headers are disabled. isIdenticalTo can end up
calling the expensive getSpelling method, and other bad stuff and is
completely unneeded if the warning will be discarded anyway. rdar://6502956
Chris Lattner [Fri, 16 Jan 2009 18:51:42 +0000 (18:51 +0000)]
minor cleanups to StringLiteralParser: no need to pass target info
into its ctor. Also, make it handle validity checking of pascal
strings instead of making clients do it.
Douglas Gregor [Fri, 16 Jan 2009 18:33:17 +0000 (18:33 +0000)]
Part one of handling C++ functional casts. This handles semantic
analysis and AST-building for the cases where we have N != 1
arguments. For N == 1 arguments, we need to finish the C++
implementation of explicit type casts (C++ [expr.cast]).
Chris Lattner [Fri, 16 Jan 2009 08:21:25 +0000 (08:21 +0000)]
Implement basic support for parsing #pragma comment, a microsoft extension
documented here:
http://msdn.microsoft.com/en-us/library/7f0aews7(VS.80).aspx
This is according to my understanding reading the docs, I don't know if it
really agrees fully with what VC++ allows.
Chris Lattner [Fri, 16 Jan 2009 07:10:29 +0000 (07:10 +0000)]
rename PP::getPhysicalCharacterAt -> PP::getSpelledCharacterAt.
Slightly speed up sema of numbers like '1' by going directly to
TargetInfo instead of through ASTContext.
Chris Lattner [Fri, 16 Jan 2009 07:00:02 +0000 (07:00 +0000)]
Change some terminology in SourceLocation: instead of referring to
the "physical" location of tokens, refer to the "spelling" location.
This is more concrete and useful, tokens aren't really physical objects!
Ted Kremenek [Thu, 15 Jan 2009 18:47:46 +0000 (18:47 +0000)]
IdentifierInfo:
- IdentifierInfo can now (optionally) have its string data not be
co-located with itself. This is for use with PTH. This aspect is a
little gross, as getName() and getLength() now make assumptions
about a possible alternate representation of IdentifierInfo.
Perhaps we should make IdentifierInfo have virtual methods?
IdentifierTable:
- Added class "IdentifierInfoLookup" that can be used by
IdentifierTable to perform "string -> IdentifierInfo" lookups using
an auxilliary data structure. This is used by PTH.
- Perform tests show that IdentifierTable::get() does not slow down
because of the extra check for the IdentiferInfoLookup object (the
regular StringMap lookup does enough work to mitigate the impact of
an extra null pointer check).
- The upshot is that now that some IdentifierInfo objects might be
owned by the IdentiferInfoLookup object. This should be reviewed.
PTH:
- Modified PTHManager::GetIdentifierInfo to *not* insert entries in
IdentifierTable's string map, and instead create IdentifierInfo
objects on the fly when mapping from persistent IDs to
IdentifierInfos. This saves a ton of work with string copies,
hashing, and StringMap lookup and resizing. This change was
motivated because when processing source files in the PTH cache we
don't need to do any string -> IdentifierInfo lookups.
- PTHManager now subclasses IdentifierInfoLookup, allowing clients of
IdentifierTable to transparently use IdentifierInfo objects managed
by the PTH file. PTHManager resolves "string -> IdentifierInfo"
queries by doing a binary search over a sorted table of identifier
strings in the PTH file (the exact algorithm we use can be changed
as needed).
These changes lead to the following performance changes when using PTH on Cocoa.h:
- fsyntax-only: 10% performance improvement
- Eonly: 30% performance improvement