Commit Graph

123 Commits

Author SHA1 Message Date
Anders Carlsson d65ab045e8 Move code from EmitUnion directly into the function that handles cast-to-union.
llvm-svn: 77735
2009-07-31 21:38:39 +00:00
Anders Carlsson 0d5f37b81a Use the struct builder for unions.
llvm-svn: 77732
2009-07-31 21:34:04 +00:00
Owen Anderson 0b75f23b94 Update for LLVM API change.
llvm-svn: 77722
2009-07-31 20:28:54 +00:00
Owen Anderson 9793f0e4d7 Update for LLVM API change.
llvm-svn: 77514
2009-07-29 22:16:19 +00:00
Ted Kremenek c23c7e6a51 Change uses of:
Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
  Type::getAsRecordType() -> Type::getAs<RecordType>()
  Type::getAsPointerType() -> Type::getAs<PointerType>()
  Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>()
  Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>()
  Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>()
  Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>()
  Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
  Type::getAsTagType() -> Type::getAs<TagType>()
  
And remove Type::getAsReferenceType(), etc.

This change is similar to one I made a couple weeks ago, but that was partly
reverted pending some additional design discussion. With Doug's pending smart
pointer changes for Types, it seemed natural to take this approach.

llvm-svn: 77510
2009-07-29 21:53:49 +00:00
Owen Anderson ade90fd1ba Update for LLVM API change.
llvm-svn: 77492
2009-07-29 18:54:39 +00:00
Owen Anderson 3cc120a51e Update for LLVM API change.
llvm-svn: 77368
2009-07-28 21:22:35 +00:00
Owen Anderson 47034e1733 Update for LLVM API change.
llvm-svn: 77349
2009-07-28 18:33:04 +00:00
Owen Anderson 0e0189d64d Update for LLVM API change.
llvm-svn: 77267
2009-07-27 22:29:56 +00:00
Owen Anderson e05f2ed478 Update for LLVM API change.
llvm-svn: 77249
2009-07-27 21:00:51 +00:00
Anders Carlsson b7130ed888 Enable the new constant struct builder by default. The old code is still in place but will be removed shortly. The new struct builder works on big endian systems.
llvm-svn: 77185
2009-07-27 05:54:15 +00:00
Anders Carlsson bff6b49cd0 More work on the constant struct builder, fix a couple of thinkos and add support for inserting part of a bitfield in the previous byte.
llvm-svn: 77180
2009-07-27 02:56:37 +00:00
Anders Carlsson ba4c6d1c91 More work on bitfield support in the new constant struct builder.
llvm-svn: 77177
2009-07-27 01:23:51 +00:00
Anders Carlsson 3b484b928d More work on the constant struct builder. We can now convert the struct to a packed struct when necessary.
llvm-svn: 77038
2009-07-25 01:40:29 +00:00
Anders Carlsson 87a9a34e5b More work on the constant struct builder. We now try to layout all constant structs but throw away the result.
llvm-svn: 77021
2009-07-25 00:24:56 +00:00
Owen Anderson b7a2fe6f81 Update for LLVM API change.
llvm-svn: 77012
2009-07-24 23:12:58 +00:00
Anders Carlsson 5e66fb5d16 Fix a release build warning.
llvm-svn: 76985
2009-07-24 18:20:38 +00:00
Anders Carlsson e1d5ca583f Check in a half finished new constant struct builder (Obviously not used yet).
llvm-svn: 76969
2009-07-24 15:20:52 +00:00
Anders Carlsson 8af896c10a Move the LLVM field number for bit fields into the BitFieldInfo structure, since it's meaning is completely different than for non-bit fields.
llvm-svn: 76882
2009-07-23 17:01:21 +00:00
Anders Carlsson 718a89a501 Use arrays as union padding. Also, since the resulting struct will always contain a single element and either a single i8 element or an array of i8s, there's no reason to use a packed struct.
llvm-svn: 76854
2009-07-23 04:50:01 +00:00
Ted Kremenek 8a286fbdb9 Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methods
until Doug Gregor's Type smart pointer code lands (or more discussion occurs).
These methods just call the new Type::getAs<XXX> methods, so we still have
reduced implementation redundancy. Having explicit getAsXXXType() methods makes
it easier to set breakpoints in the debugger.

llvm-svn: 76193
2009-07-17 17:50:17 +00:00
Ted Kremenek b825c0ddc5 Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents.
llvm-svn: 76139
2009-07-17 01:20:38 +00:00
Owen Anderson 170229f68d Update for LLVM API change, and contextify a bunch of related stuff.
llvm-svn: 75705
2009-07-14 23:10:40 +00:00
Owen Anderson 2571eb6453 Update for API change.
llvm-svn: 75569
2009-07-14 00:38:16 +00:00
Owen Anderson ae86c19e68 Update for LLVM API change.
llvm-svn: 75446
2009-07-13 04:10:07 +00:00
Owen Anderson c10c8d3e2b Update for LLVM API change.
llvm-svn: 75028
2009-07-08 19:05:04 +00:00
Owen Anderson 9f211fb4fa Update for LLVM API change.
llvm-svn: 74986
2009-07-08 01:29:18 +00:00
Argyrios Kyrtzidis cfbfe78e9e De-ASTContext-ify DeclContext.
Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating".
Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit.

llvm-svn: 74506
2009-06-30 02:36:12 +00:00
Eli Friedman 6282b3cff8 PR4390: Make sure to handle anonymous unions correctly while building
static intializers for structs.

llvm-svn: 73349
2009-06-14 21:41:37 +00:00
Chris Lattner 15ba94987a Sink the BuiltinInfo object from ASTContext into the
preprocessor and initialize it early in clang-cc.  This
ensures that __has_builtin works in all modes, not just
when ASTContext is around.

llvm-svn: 73319
2009-06-14 01:54:56 +00:00
Eli Friedman 751aa72b72 Fix up constant expression handling to deal with the address
of a reference correctly.

llvm-svn: 72463
2009-05-27 06:04:58 +00:00
Mike Stump 18bb9284ff Reflow some comments.
llvm-svn: 71937
2009-05-16 07:57:57 +00:00
Chris Lattner e0be0dfced push GlobalDecl through enough of the CodeGenModule interfaces
to allow us to support generation of deferred ctors/dtors.
It looks like codegen isn't emitting a call to the dtor in 
member-functions.cpp:test2, but when it does, its body should
get emitted.

llvm-svn: 71594
2009-05-12 21:21:08 +00:00
Duncan Sands c76fe8b611 Correct for renaming PaddedSize -> AllocSize in
LLVM.

llvm-svn: 71350
2009-05-09 07:08:47 +00:00
Eli Friedman 7ce29a18e1 Fix crash with constant initialization of bit-fields in unions.
llvm-svn: 71194
2009-05-07 23:42:42 +00:00
Eli Friedman 902fddd1cf Fix for PR4108: be a bit looser with the casts that we accept in
constant initializers.

llvm-svn: 70483
2009-04-30 07:03:22 +00:00
Eli Friedman 20bb5e02a5 Minor work related to removing the assumption that value initialization
implies an all-zero bit pattern.

llvm-svn: 68994
2009-04-13 21:47:26 +00:00
Anders Carlsson d8e39bbb84 Add support for generating reference initialization code.
llvm-svn: 68852
2009-04-11 01:08:03 +00:00
Anders Carlsson 6ef4ea499f Rename variables to avoid conflict.
llvm-svn: 68764
2009-04-10 04:59:59 +00:00
Douglas Gregor bcced4ec31 Propagate the ASTContext to various AST traversal and lookup functions.
No functionality change (really).

llvm-svn: 68726
2009-04-09 21:40:53 +00:00
Anders Carlsson 80f97ab08f Add a destination type argument to EmitConstantExpr. This will be used for when the destination has a reference type. (No functionality change yet)
llvm-svn: 68593
2009-04-08 04:48:15 +00:00
Steve Naroff e14b368fa9 More "prep" work for handling UTF16 CFString.
Patch by Jean-Daniel Dupas. Thanks!

llvm-svn: 68203
2009-04-01 13:55:36 +00:00
Steve Naroff 66afeb5968 Some "prep" work for handling ObjC @-string constants that contain UTF-8. No functionality change.
Changed GenerateConstantString() to take an ObjCStringLiteral (instead of a std::string). While this isn't strictly necessary, it seems cleaner and allows us to cache to "containsNonAscii" if necessary (to avoid checking in both Sema and CodeGen).

llvm-svn: 68114
2009-03-31 16:53:37 +00:00
Anders Carlsson 24b1447b19 Return 0 if the ConstExprEmitter can't handle an expression.
llvm-svn: 65951
2009-03-03 16:43:34 +00:00
Anders Carlsson ed5e69fe50 Do some blocks cleanup and simplification. Fix a crash, and add a test case.
llvm-svn: 65746
2009-03-01 01:09:12 +00:00
Mike Stump b750d928ce CodeGen support for copied BlockDeclRefExprs.
llvm-svn: 65487
2009-02-25 23:33:13 +00:00
Chris Lattner d7e7b8e411 first wave of fixes for @encode sema support. This is part of PR3648.
The big difference here is that (like string literal) @encode has 
array type, not pointer type.

llvm-svn: 65391
2009-02-24 22:18:39 +00:00
Daniel Dunbar d4ecca135a Fix IRgen of constant expressions referring to external/static
variables.
 - PR3657.

llvm-svn: 65381
2009-02-24 18:41:57 +00:00
Eli Friedman 825fe7565e Eliminate a bunch of code which should be dead.
llvm-svn: 65267
2009-02-22 07:29:04 +00:00
Mike Stump a67033294a Add enough checking to ensure that non-constant block literals don't
appear to be constant.  I'll probably redo this and throw it all away
later once we have codegen for BlockDeclRefExprs.

llvm-svn: 65070
2009-02-19 22:01:56 +00:00