Commit Graph

3065 Commits

Author SHA1 Message Date
Ted Kremenek 8433f0b400 PTH: Emitted tokens now consist of 12 bytes that are loaded used 3 32-bit loads. This reduces user time but increases system time because of the slightly larger PTH file. Although there is no performance win on Cocoa.h and -Eonly, overall this seems like a good step.
llvm-svn: 62542
2009-01-19 23:13:15 +00:00
Steve Naroff d21d7226b1 Make sure all types are allocated with 8-byte alignment.
The QualType smart pointer assumes we have 3 flag bits available.

llvm-svn: 62540
2009-01-19 22:45:10 +00:00
Sebastian Redl b5d49356e6 Convert more expression actions to smart pointers.
llvm-svn: 62537
2009-01-19 22:31:54 +00:00
Ted Kremenek 721e239f2b Allocate Types using ASTContext's 'Allocator' object.
llvm-svn: 62530
2009-01-19 21:31:22 +00:00
Fariborz Jahanian 54fa418d03 Type of property and its ivar is more restrictive
that rules for assignment.

llvm-svn: 62524
2009-01-19 20:13:47 +00:00
Douglas Gregor dd430f7ec9 Centralize error reporting of improper uses of incomplete types in the
new DiagnoseIncompleteType. It provides additional information about
struct/class/union/enum types when possible, either by pointing to the
forward declaration of that type or by pointing to the definition (if
we're in the process of defining that type). 
Fixes <rdar://problem/6500531>.

llvm-svn: 62521
2009-01-19 19:26:10 +00:00
Fariborz Jahanian dab04840f0 Patch to allow @dynamic synthesis of property in a category,
with @synthesize being illegal.

llvm-svn: 62515
2009-01-19 18:16:19 +00:00
Chris Lattner 4fd8b958be do not use SourceManager::getFileCharacteristic(FileID), it is not
safe because a #line can change the file characteristic on a per-loc
basis.

llvm-svn: 62502
2009-01-19 08:01:53 +00:00
Chris Lattner c033416639 do not use SourceManager::getFileCharacteristic(FileID), it is not
safe because a #line can change the file characteristic on a per-loc
basis.

llvm-svn: 62501
2009-01-19 07:59:15 +00:00
Chris Lattner cbc35ecb04 Rename SourceManager::getCanonicalFileID -> getFileID. There is
no longer such thing as a non-canonical FileID.

llvm-svn: 62499
2009-01-19 07:46:45 +00:00
Ted Kremenek 8c3b812148 Run destructors of MacroInfo objects to free memory they allocate. This addresses <rdar://problem/6506035>.
llvm-svn: 62498
2009-01-19 07:45:44 +00:00
Chris Lattner 1e9e86f470 remove the public SourceManager::getContentCacheForLoc method.
llvm-svn: 62497
2009-01-19 07:40:40 +00:00
Chris Lattner f809bbdbb8 remove the SourceManager:: and FullSourceLoc::getFileEntryForLoc methods.
llvm-svn: 62496
2009-01-19 07:36:42 +00:00
Chris Lattner 7e343b2161 SourceManager::getBufferData(SourceLocation) is dead, delete it.
llvm-svn: 62495
2009-01-19 07:32:13 +00:00
Chris Lattner 91fda39454 some minor cleanups to SourceManager, and eliminate the
SourceManager::getBuffer(SourceLocation) method.

llvm-svn: 62494
2009-01-19 07:30:29 +00:00
Chris Lattner 02495d80ef Make some enums in SourceLocation private, remove a useless assertion from ScratchBuffer.
llvm-svn: 62492
2009-01-19 06:57:37 +00:00
Chris Lattner 29a2a191f2 Make SourceLocation::getFileLoc private to reduce the API exposure of
SourceLocation.  This requires making some cleanups to token pasting
and _Pragma expansion.

llvm-svn: 62490
2009-01-19 06:46:35 +00:00
Sebastian Redl c215cfc3e1 Convert more expression actions to smart pointers.
Fix type of logical negation for C++.

llvm-svn: 62475
2009-01-19 00:08:26 +00:00
Chris Lattner fc014f80e5 fix rdar://6505352 - Bogus warning with -WUndef, a case
Anders noticed.

llvm-svn: 62472
2009-01-18 21:18:58 +00:00
Nuno Lopes 9018ca711a fix deallocation of FunctionDecl::ParamInfo
llvm-svn: 62469
2009-01-18 19:57:27 +00:00
Sebastian Redl ffbcf96d1c Convert a few expression actions to smart pointers.
These actions are extremely widely used (identifier expressions and literals); still no performance regression.

llvm-svn: 62468
2009-01-18 18:53:16 +00:00
Sebastian Redl c2edafbdff Rename move_convert to move_arg and move_res. The new names are less misleading (and shorter).
llvm-svn: 62466
2009-01-18 18:03:53 +00:00
Sebastian Redl 481bf3f48b Convert ObjC statement actions to smart pointers.
llvm-svn: 62465
2009-01-18 17:43:11 +00:00
Sebastian Redl 24b8e15dfa Convert asm statement action to smart pointers.
llvm-svn: 62464
2009-01-18 16:53:17 +00:00
Sebastian Redl 573feed2a8 Convert more statement actions to smart pointers.
llvm-svn: 62463
2009-01-18 13:19:59 +00:00
Chris Lattner c671e061eb Switch MinimalAction from new/delete'ing its TypeNameInfo to
allocating them from a recycling bump pointer allocator.  This 
reduces malloc/free traffic of parse-noop (but no other mode),
which makes sharking -parse-noop more meaningful.

llvm-svn: 62460
2009-01-18 09:39:41 +00:00
Nate Begeman b699c9bf57 Vector codegen improvements
llvm-svn: 62458
2009-01-18 06:42:49 +00:00
Nate Begeman 2f2bdeb5df Support evaluation of vector constant expressions, and codegen of same.
llvm-svn: 62455
2009-01-18 03:20:47 +00:00
Chris Lattner 144aacd19e rearrange GetIdentifierInfo so that the fast path can be partially inlined into PTHLexer::Lex. This speeds up the user time of PTH -Eonly by another 2ms (4.4%)
llvm-svn: 62454
2009-01-18 02:57:21 +00:00
Chris Lattner 18fc6ceb56 rename some variables, only set a tokens identifierinfo if non-null.
llvm-svn: 62450
2009-01-18 02:34:01 +00:00
Chris Lattner 9cdd877436 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%.

llvm-svn: 62447
2009-01-18 02:19:16 +00:00
Anders Carlsson e70cde134e Handle the 'X' constraint. Fixes <rdar://problem/6504897>.
llvm-svn: 62446
2009-01-18 02:12:04 +00:00
Chris Lattner 137d6492a8 switch PTHLexer to use Read32 and friends instead of lots of inlined
copies.  I verified that this causes no performance change in PTH.

llvm-svn: 62445
2009-01-18 02:10:31 +00:00
Anders Carlsson a92271d067 CG support for inline asm constraints with symbolic names. Fixes PR3345
llvm-svn: 62444
2009-01-18 02:06:20 +00:00
Nate Begeman 7e5185b264 A couple more vector component access fixes.
llvm-svn: 62443
2009-01-18 02:01:21 +00:00
Chris Lattner eb09754a9d 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.

llvm-svn: 62442
2009-01-18 01:57:14 +00:00
Anders Carlsson a79203be85 Add sema support for symbolic names in inline asm statements.
llvm-svn: 62441
2009-01-18 01:56:57 +00:00
Nate Begeman bb70bf6dbb Update support for vector component access on ExtVectors.
llvm-svn: 62440
2009-01-18 01:47:54 +00:00
Nate Begeman 95439108e8 Fit in 80 cols
llvm-svn: 62439
2009-01-18 01:08:03 +00:00
Nate Begeman 1e31b168fa Add support for vectors to APValue. Vector constant evaluator and tests coming.
llvm-svn: 62438
2009-01-18 01:01:34 +00:00
Nate Begeman c1bf0612dd Remove outdated diagnostic. Tests are coming.
llvm-svn: 62437
2009-01-18 00:45:31 +00:00
Nate Begeman a45707c06a Allow targets to override IntMaxTWidth
llvm-svn: 62434
2009-01-17 23:56:13 +00:00
Anders Carlsson 19aa04d270 Change TargetInfo::validateInputConstraint to take begin/end name iterators instead of the number of outputs. No functionality change.
llvm-svn: 62433
2009-01-17 23:36:15 +00:00
Fariborz Jahanian 18789e1c21 Diagnose that property name cannot be a bitfield
llvm-svn: 62432
2009-01-17 23:21:10 +00:00
Fariborz Jahanian 091ae97786 Diagnose when method parameter is an object.
llvm-svn: 62431
2009-01-17 21:57:49 +00:00
Fariborz Jahanian 705c6d9cdd Patch to re-implement ivar-list meta-data generation to fix
cases of unnamed ivar bitfields.

llvm-svn: 62429
2009-01-17 19:36:33 +00:00
Chris Lattner 71dc14b9f0 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.

llvm-svn: 62427
2009-01-17 08:45:21 +00:00
Chris Lattner 5509d533f6 simplify some lookups.
llvm-svn: 62426
2009-01-17 08:30:10 +00:00
Chris Lattner 757169b60f 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.

llvm-svn: 62425
2009-01-17 08:27:52 +00:00
Chris Lattner ab1d4b8abd simplify PTHManager::CreateLexer
llvm-svn: 62424
2009-01-17 08:06:50 +00:00
Chris Lattner c809089b26 Change the Lexer ctor used in the non _Pragma case to take a FileID instead
of a SourceLocation.  This should speed it up and definitely simplifies it.

llvm-svn: 62422
2009-01-17 08:03:42 +00:00
Chris Lattner 8ddb5cf0cf in Preprocessor::AdvanceToTokenCharacter, don't actually bother
creating a whole lexer when we just want one static method.

llvm-svn: 62420
2009-01-17 07:57:25 +00:00
Chris Lattner 5965a28a4b More simplifications to the lexer ctors.
llvm-svn: 62419
2009-01-17 07:56:59 +00:00
Chris Lattner fcf6452eb4 make the verbose raw-lexer ctor fully explicit instead of having
embedded magic.

llvm-svn: 62417
2009-01-17 07:42:27 +00:00
Chris Lattner 08354fef13 add a simplified lexer ctor that sets up the lexer to raw-lex an
entire file.

llvm-svn: 62414
2009-01-17 07:35:14 +00:00
Chris Lattner f76b92092e refactor some common initialization code out of the two lexer ctors.
llvm-svn: 62411
2009-01-17 06:55:17 +00:00
Chris Lattner 3793bba26f suck the call to "getSpellingLoc" that all clients do into
the implementation of PTHManager::getSpelling.

llvm-svn: 62408
2009-01-17 06:29:33 +00:00
Chris Lattner d32480d3db 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.

llvm-svn: 62407
2009-01-17 06:22:33 +00:00
Chris Lattner 800979259e make "ContentCache::Buffer" mutable to avoid a const_cast.
llvm-svn: 62403
2009-01-17 03:54:16 +00:00
Chris Lattner 1abd20901b 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.

llvm-svn: 62401
2009-01-17 03:48:08 +00:00
Douglas Gregor 051d8fd809 Warn about typedefs of enums without any declarator name. Fixes rdar://problem/6503878
llvm-svn: 62397
2009-01-17 02:55:50 +00:00
Ted Kremenek 1ab188f48a Fix analyzer crash found when scanning Wine sources where the analyzer used old logic to determine the value of a switch 'case' label.
llvm-svn: 62395
2009-01-17 01:54:16 +00:00
Douglas Gregor f23311d63b PODify LookupResult, for a measly 1% speedup on Cocoa.h.
llvm-svn: 62391
2009-01-17 01:13:24 +00:00
Nuno Lopes 4d78cf0fa7 add support for usage of cast to union thing with static vars
llvm-svn: 62387
2009-01-17 00:48:48 +00:00
Douglas Gregor dee1be8e95 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.

llvm-svn: 62386
2009-01-17 00:42:38 +00:00
Fariborz Jahanian 94234ea63e Catch a foreach parse error.
llvm-svn: 62382
2009-01-17 00:00:40 +00:00
Sebastian Redl fbfaafc0a9 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.

llvm-svn: 62380
2009-01-16 23:28:06 +00:00
Chris Lattner 48a8c57936 eliminate FullSourceLoc::getLocation() now that FullSourceLoc
*is* the location.  This eliminates some weird X.getLocation().getLocation()'s.

llvm-svn: 62376
2009-01-16 23:06:35 +00:00
Chris Lattner fb1fd911cb Make FullSourceLoc derive from SourceLocation instead of
containing one.  Containment is generally better than derivation,
but in this case FullSourceLoc really 'isa' SourceLocation.

llvm-svn: 62375
2009-01-16 23:03:56 +00:00
Chris Lattner fcc0a5a3f7 elimiante FullSourceLoc::getCanonicalFileID
llvm-svn: 62374
2009-01-16 22:59:51 +00:00
Chris Lattner 7067b4f49d remove FullSourceLoc::isFileID
llvm-svn: 62371
2009-01-16 22:53:56 +00:00
Chris Lattner 671689a440 an instantiation loc is always a file loc.
llvm-svn: 62370
2009-01-16 22:53:27 +00:00
Chris Lattner 5882771102 Fix PR2477 - clang misparses "//*" in C89 mode
llvm-svn: 62368
2009-01-16 22:39:25 +00:00
Fariborz Jahanian 10401ce2e0 Don't ICE (issue diagnostics) when receiver is a non-objc
type.

llvm-svn: 62355
2009-01-16 20:35:09 +00:00
Fariborz Jahanian 1778f4bf6d Don't ICE on user redeclaration of objc's built-in types.
Issue diagnostics instead if types do not match.

llvm-svn: 62349
2009-01-16 19:58:32 +00:00
Chris Lattner 5244f34e75 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

llvm-svn: 62347
2009-01-16 19:50:11 +00:00
Chris Lattner d3fb18fba2 silence release-assert warning.
llvm-svn: 62346
2009-01-16 19:44:00 +00:00
Douglas Gregor 225b321a85 Fix <rdar://problem/6502934>. We were creating an ImplicitCastExpr
with reference type (it should be an lvalue with non-reference type).

llvm-svn: 62345
2009-01-16 19:38:23 +00:00
Ted Kremenek 0755a34604 StringRegion::print: Remove copy/paste code and just call Stmt::printPretty() for the StringLiteral.
llvm-svn: 62340
2009-01-16 19:26:50 +00:00
Chris Lattner bb96cc45ae make ast-print handle random non-printable characters correctly with octal escapes.
llvm-svn: 62337
2009-01-16 19:25:18 +00:00
Fariborz Jahanian 55ca58ed61 Changed the API yet again.
llvm-svn: 62335
2009-01-16 19:02:53 +00:00
Chris Lattner f49775dc81 only notify callbacks if they exist.
llvm-svn: 62334
2009-01-16 19:01:46 +00:00
Chris Lattner 262d4e31b9 Improve #pragma comment support by building the string argument and
notifying PPCallbacks about it.

llvm-svn: 62333
2009-01-16 18:59:23 +00:00
Chris Lattner 8a24e588d7 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.

llvm-svn: 62332
2009-01-16 18:51:42 +00:00
Ted Kremenek 86afde337d Fix PR 3337 [retain/release checker]: Handle FunctionDecl's declared using typedefs.
llvm-svn: 62331
2009-01-16 18:40:33 +00:00
Douglas Gregor dd04d33e3a 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]).

llvm-svn: 62329
2009-01-16 18:33:17 +00:00
Fariborz Jahanian 195d36cb57 Used a more suitable api to get to the type of a record
in code gen.

llvm-svn: 62326
2009-01-16 17:41:13 +00:00
Anders Carlsson a7d069d63c Use a single function for doing vararg argument promotion. Also, make sure to do the promotion before checking the type - fixes PR3340.
llvm-svn: 62323
2009-01-16 16:48:51 +00:00
Chris Lattner 2ff698df60 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.

llvm-svn: 62317
2009-01-16 08:21:25 +00:00
Chris Lattner 8a42586c54 more SourceLocation lexicon change: instead of referring to the
"logical" location, refer to the "instantiation" location.

llvm-svn: 62316
2009-01-16 07:36:28 +00:00
Chris Lattner 3c91971b33 rename "virtual location" of a macro to "instantiation location".
llvm-svn: 62315
2009-01-16 07:15:35 +00:00
Chris Lattner c4c181902e rename PP::getPhysicalCharacterAt -> PP::getSpelledCharacterAt.
Slightly speed up sema of numbers like '1' by going directly to 
TargetInfo instead of through ASTContext.

llvm-svn: 62314
2009-01-16 07:10:29 +00:00
Chris Lattner 7c8556e7bc remove obsolete comment which happened to go over 80 cols.
llvm-svn: 62313
2009-01-16 07:04:11 +00:00
Chris Lattner 15af77f679 remove an unneeded const_cast.
llvm-svn: 62311
2009-01-16 07:02:14 +00:00
Chris Lattner 53e384f633 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!

llvm-svn: 62309
2009-01-16 07:00:02 +00:00
Douglas Gregor 2b5d430096 Don't advance the statement iterator after we've deallocated the statement
llvm-svn: 62306
2009-01-16 06:50:08 +00:00
Zhongxing Xu ac8ef9ea4c Extract code dealing with typedef declarators into a separate function.
No functionality change.

llvm-svn: 62303
2009-01-16 03:34:13 +00:00
Zhongxing Xu 9b7714d909 Extract code dealing with variable declarator into a separate function.
No functionality change.

llvm-svn: 62300
2009-01-16 02:36:34 +00:00
Daniel Dunbar f557d831a7 Attempt to unbreak Windows build.
llvm-svn: 62295
2009-01-16 01:50:29 +00:00
Fariborz Jahanian dae9276090 postpone sizeof objc-class computatin to the clients.
llvm-svn: 62292
2009-01-16 01:42:12 +00:00