summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Replace calls to getTypeSize() and getTypeAlign() with their 'InChars' Ken Dyck2011-01-191-4/+6
| | | | | | counterparts where char units are needed. llvm-svn: 123805
* Emit DW_TAG_lexical_scope to surround foreach.Devang Patel2011-01-191-0/+12
| | | | llvm-svn: 123802
* Fix warnings found by gcc-4.6, from -Wunused-but-set-variable andJeffrey Yasskin2011-01-181-3/+0
| | | | | | -Wint-to-pointer-cast. llvm-svn: 123719
* Move name mangling support from CodeGen to AST. In thePeter Collingbourne2011-01-131-0/+2
| | | | | | | | | | | | | | process, perform a number of refactorings: - Move MiscNameMangler member functions to MangleContext - Remove GlobalDecl dependency from MangleContext - Make MangleContext abstract and move Itanium/Microsoft functionality to their own classes/files - Implement ASTContext::createMangleContext and have CodeGen use it No (intended) functionality change. llvm-svn: 123386
* Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,Alexis Hunt2011-01-081-3/+3
| | | | | | | more accurate, and makes it make sense for it to hold a delegating constructor call. llvm-svn: 123084
* Rework a few things about how we emit ObjC's for enumeration statement.John McCall2011-01-071-95/+126
| | | | | | | | | | In particular, the iteration variable (if present) should be created and destroyed in a narrow span around the loop body, and the body should be emitted in a cleanup scope in case it's not a compound statement. Otherwise, rename a few variables and use phis instead of temporary variables for the index and buffer count. llvm-svn: 122988
* Add support for GNU runtime property set / get structure functions. Minor ↵David Chisnall2010-12-261-4/+4
| | | | | | refactoring of Mac runtime (returns the same function for both, as the Mac runtimes currently only provide a single entry point for setting and getting struct properties, although this will presumably be fixed at some point). llvm-svn: 122569
* Fix a bug in the emission of __real/__imag l-values on scalar operands.John McCall2010-12-051-2/+1
| | | | | | | | | Fix a bug in the emission of complex compound assignment l-values. Introduce a method to emit an expression whose value isn't relevant. Make that method evaluate its operand as an l-value if it is one. Fixes our volatile compliance in C++. llvm-svn: 120931
* More anonymous struct/union redesign. This one deals with anonymous field ↵Francois Pichet2010-12-041-2/+2
| | | | | | | | | | | | | | | | used in a constructor initializer list: struct X { X() : au_i1(123) {} union { int au_i1; float au_f1; }; }; clang will now deal with au_i1 explicitly as an IndirectFieldDecl. llvm-svn: 120900
* Test case for the l-value base only being evaluated once.John McCall2010-12-041-44/+43
| | | | | | | | | | Also, move the l-value emission code into CGObjC.cpp and teach it, for completeness, to store away self for a super send. Also, inline the super cases for property gets and sets and make them use the correct result type for implicit getter/setter calls. llvm-svn: 120887
* Kill the KVC l-value kind and calculate the base expression when emittingJohn McCall2010-12-041-20/+12
| | | | | | the l-value. llvm-svn: 120884
* Simplify the ASTs by consolidating ObjCImplicitGetterSetterExpr and ↵John McCall2010-12-021-63/+55
| | | | | | | | ObjCPropertyRefExpr into the latter. llvm-svn: 120643
* Calculate the value kind of an expression when it's created andJohn McCall2010-11-181-4/+4
| | | | | | | | | | | | | store it on the expression node. Also store an "object kind", which distinguishes ordinary "addressed" l-values (like variable references and pointer dereferences) and bitfield, @property, and vector-component l-values. Currently we're not using these for much, but I aim to switch pretty much everything calculating l-valueness over to them. For now they shouldn't necessarily be trusted. llvm-svn: 119685
* Eliminate usage of ObjCSuperExpr used forFariborz Jahanian2010-10-141-4/+4
| | | | | | | 'super' as receiver of property or a setter/getter methods. //rdar: //8525788 llvm-svn: 116483
* one piece of code is responsible for the lifetime of every aggregateJohn McCall2010-09-151-4/+2
| | | | | | | | | | | | | slot. The easiest way to do that was to bundle up the information we care about for aggregate slots into a new structure which demands that its creators at least consider the question. I could probably be convinced that the ObjC 'needs GC' bit should be rolled into this structure. Implement generalized copy elision. The main obstacle here is that IR-generation must be much more careful about making sure that exactly llvm-svn: 113962
* IRGen fix for using property-dot syntax to pass Fariborz Jahanian2010-09-101-1/+2
| | | | | | | reference object to a c++ member function. fixes radar 8409336. llvm-svn: 113602
* GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall2010-08-251-3/+3
| | | | | | to the new constants. llvm-svn: 112047
* More incremental progress towards not including Expr.h in Sema.h.John McCall2010-08-251-1/+1
| | | | llvm-svn: 112044
* Store inheritance paths after CastExprs instead of inside them.John McCall2010-08-071-2/+2
| | | | | | | | | | | | | | | This takes some trickery since CastExpr has subclasses (and indeed, is abstract). Also, smoosh the CastKind into the bitfield from Expr. Drops two words of storage from Expr in the common case of expressions which don't need inheritance paths. Avoids a separate allocation and another word of overhead in cases needing inheritance paths. Also has the advantage of not leaking memory, since destructors for AST nodes are never run. llvm-svn: 110507
* Return type of a setter call caused byFariborz Jahanian2010-07-241-1/+1
| | | | | | | | use of property-dot syntax using 'super' as receiver is 'void'. This fixes a bug in generating correct API for setter call. Fixes radar 8203426. llvm-svn: 109297
* Revise cleanup IR generation to fix a major bug with cleanups (PR7686)John McCall2010-07-231-2/+2
| | | | | | | as well as some significant asymptotic inefficiencies with threading multiple jumps through deep cleanups. llvm-svn: 109274
* Update ImplicitCastExpr to be able to represent an XValue.Sebastian Redl2010-07-201-1/+2
| | | | llvm-svn: 108807
* Validated by nightly-test runs on x86 and x86-64 darwin, including afterJohn McCall2010-07-061-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | self-host. Hopefully these results hold up on different platforms. I tried to keep the GNU ObjC runtime happy, but it's hard for me to test. Reimplement how clang generates IR for exceptions. Instead of creating new invoke destinations which sequentially chain to the previous destination, push a more semantic representation of *why* we need the cleanup/catch/filter behavior, then collect that information into a single landing pad upon request. Also reorganizes how normal cleanups (i.e. cleanups triggered by non-exceptional control flow) are generated, since it's actually fairly closely tied in with the former. Remove the need to track which cleanup scope a block is associated with. Document a lot of previously poorly-understood (by me, at least) behavior. The new framework implements the Horrible Hack (tm), which requires every landing pad to have a catch-all so that inlining will work. Clang no longer requires the Horrible Hack just to make exceptions flow correctly within a function, however. The HH is an unfortunate requirement of LLVM's EH IR. llvm-svn: 107631
* Remove unnecessary ASTContext parameter fromDouglas Gregor2010-07-011-1/+1
| | | | | | CXXRecordDecl::getDestructor(); no functionality change. llvm-svn: 107394
* Fix an Obj-C++ miscompile when calling an Obj-C method that returns a C++ ↵Anders Carlsson2010-06-211-2/+5
| | | | | | reference. llvm-svn: 106477
* When using property-dot assignment syntax to call a setter method,Fariborz Jahanian2010-06-071-2/+4
| | | | | | | type of rhs need be compared to setter's argument and not the getter type. Fixes radar 8062778 llvm-svn: 105560
* Re-land the fix for PR7139.Anders Carlsson2010-05-221-1/+1
| | | | llvm-svn: 104446
* Push a return-value slot throughout ObjC message-send codegen. Will beJohn McCall2010-05-221-13/+21
| | | | | | | critical for ObjC++ correctness; hard to test independently of various required Sema changes, though. llvm-svn: 104422
* Unbreak self-host.Anders Carlsson2010-05-211-1/+1
| | | | llvm-svn: 104390
* Rename CodeGenFunction::EmitMemSetToZero to EmitNullInitialization. Handle ↵Anders Carlsson2010-05-211-1/+1
| | | | | | setting null data member pointers correctly. Fixes PR7139. llvm-svn: 104387
* Allocate space in a block record for implicit references to the Objective CJohn McCall2010-05-211-2/+0
| | | | | | | | | | 'self' variable arising from uses of the 'super' keyword. Also reorganize some code so that BlockInfo (now CGBlockInfo) can be opaque outside of CGBlocks.cpp. Fixes rdar://problem/8010633. llvm-svn: 104312
* Correctly generate IR for ObjC messages sends to protocol-qualified types.John McCall2010-05-171-4/+5
| | | | | | Fixes rdar://problem/7992749 llvm-svn: 103965
* Substantially alter the design of the Objective C type AST by introducingJohn McCall2010-05-151-1/+1
| | | | | | | | | | | | | | | | | | | | | ObjCObjectType, which is basically just a pair of one of {primitive-id, primitive-Class, user-defined @class} with a list of protocols. An ObjCObjectPointerType is therefore just a pointer which always points to one of these types (possibly sugared). ObjCInterfaceType is now just a kind of ObjCObjectType which happens to not carry any protocols. Alter a rather large number of use sites to use ObjCObjectType instead of ObjCInterfaceType. Store an ObjCInterfaceType as a pointer on the decl rather than hashing them in a FoldingSet. Remove some number of methods that are no longer used, at least after this patch. By simplifying ObjCObjectPointerType, we are now able to easily remove and apply pointers to Objective-C types, which is crucial for a certain kind of ObjC++ metaprogramming common in WebKit. llvm-svn: 103870
* Implement semantic analysis and an AST representation for the namedDouglas Gregor2010-05-151-1/+2
| | | | | | | | | | | | return value optimization. Sema marks return statements with their NRVO candidates (which may or may not end up using the NRVO), then, at the end of a function body, computes and marks those variables that can be allocated into the return slot. I've checked this locally with some debugging statements (not committed), but there won't be any tests until CodeGen comes along. llvm-svn: 103865
* Code Gen support for Getter/Setter synthesis of Fariborz Jahanian2010-05-061-3/+23
| | | | | | C++ object properties. (still radar 7468090). llvm-svn: 103182
* Clean up the {} and else placement. This fixes an ambiguous else as well asChandler Carruth2010-05-061-6/+6
| | | | | | picking a more consistent pattern. llvm-svn: 103142
* This patch deals with Sema Part of Setter/Getter synthesisFariborz Jahanian2010-05-051-6/+0
| | | | | | | of properties which are of C++ objects. Code Gen to follow (Radar 7468090). llvm-svn: 103123
* Fixes a code gen. crash when ivar object has trivial constructor.Fariborz Jahanian2010-05-041-12/+14
| | | | llvm-svn: 103028
* Add the same 'ForVirtualBase' parameter to EmitCXXDestructorCall.Anders Carlsson2010-05-021-1/+2
| | | | llvm-svn: 102882
* Support for construct/destruct of ivar arrayFariborz Jahanian2010-04-281-7/+18
| | | | | | | of c++ objects (NeXt runtime). radar 7900343. llvm-svn: 102546
* IRGen for initialization/destruction ofFariborz Jahanian2010-04-281-0/+49
| | | | | | | ivar class objects (NeXt runtime). (radar 7900343). llvm-svn: 102533
* Changed signature of GenerateMessageSend() function to pass the ↵David Chisnall2010-04-281-8/+10
| | | | | | | | ObjCInterfaceDecl for class messages and removed the boolean IsClassMessage argument, which wasn't used anywhere. Emitted some metadata on message sends to allow a later pass to do some speculative inlining of class methods (GNU runtime). Speculative inlining of instance methods requires type feedback to be useful (work in progress), but for class methods it works quite nicely. llvm-svn: 102514
* CastExpr should not hold a pointer to the base path. More cleanup.Anders Carlsson2010-04-241-1/+1
| | | | llvm-svn: 102249
* Add an InheritancePath parameter to the ImplicitCastExpr constructor.Anders Carlsson2010-04-231-1/+1
| | | | llvm-svn: 102218
* Suppress compiler warning.Daniel Dunbar2010-04-221-1/+1
| | | | llvm-svn: 102047
* Overhaul the AST representation of Objective-C message sendDouglas Gregor2010-04-211-18/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | expressions, to improve source-location information, clarify the actual receiver of the message, and pave the way for proper C++ support. The ObjCMessageExpr node represents four different kinds of message sends in a single AST node: 1) Send to a object instance described by an expression (e.g., [x method:5]) 2) Send to a class described by the class name (e.g., [NSString method:5]) 3) Send to a superclass class (e.g, [super method:5] in class method) 4) Send to a superclass instance (e.g., [super method:5] in instance method) Previously these four cases where tangled together. Now, they have more distinct representations. Specific changes: 1) Unchanged; the object instance is represented by an Expr*. 2) Previously stored the ObjCInterfaceDecl* referring to the class receiving the message. Now stores a TypeSourceInfo* so that we know how the class was spelled. This both maintains typedef information and opens the door for more complicated C++ types (e.g., dependent types). There was an alternative, unused representation of these sends by naming the class via an IdentifierInfo *. In practice, we either had an ObjCInterfaceDecl *, from which we would get the IdentifierInfo *, or we fell into the case below... 3) Previously represented by a class message whose IdentifierInfo * referred to "super". Sema and CodeGen would use isStr("super") to determine if they had a send to super. Now represented as a "class super" send, where we have both the location of the "super" keyword and the ObjCInterfaceDecl* of the superclass we're targetting (statically). 4) Previously represented by an instance message whose receiver is a an ObjCSuperExpr, which Sema and CodeGen would check for via isa<ObjCSuperExpr>(). Now represented as an "instance super" send, where we have both the location of the "super" keyword and the ObjCInterfaceDecl* of the superclass we're targetting (statically). Note that ObjCSuperExpr only has one remaining use in the AST, which is for "super.prop" references. The new representation of ObjCMessageExpr is 2 pointers smaller than the old one, since it combines more storage. It also eliminates a leak when we loaded message-send expressions from a precompiled header. The representation also feels much cleaner to me; comments welcome! This patch attempts to maintain the same semantics we previously had with Objective-C message sends. In several places, there are massive changes that boil down to simply replacing a nested-if structure such as: if (message has a receiver expression) { // instance message if (isa<ObjCSuperExpr>(...)) { // send to super } else { // send to an object } } else { // class message if (name->isStr("super")) { // class send to super } else { // send to class } } with a switch switch (E->getReceiverKind()) { case ObjCMessageExpr::SuperInstance: ... case ObjCMessageExpr::Instance: ... case ObjCMessageExpr::SuperClass: ... case ObjCMessageExpr::Class:... } There are quite a few places (particularly in the checkers) where send-to-super is effectively ignored. I've placed FIXMEs in most of them, and attempted to address send-to-super in a reasonable way. This could use some review. llvm-svn: 101972
* Removes a FIXME.Fariborz Jahanian2010-04-131-4/+2
| | | | llvm-svn: 101161
* Variation of objc_copyStruct API generation whenFariborz Jahanian2010-04-131-7/+21
| | | | | | | property (atomic/nonatomic) is of aggregate type with gc'able member objects) (NeXT runtime). llvm-svn: 101156
* Add support for objc_copyStruct to enforceFariborz Jahanian2010-04-131-1/+79
| | | | | | | atomicity of aggregate properties in setter/getter methods. wip. llvm-svn: 101107
* revert 100942, pending discussion.Chris Lattner2010-04-101-1/+1
| | | | llvm-svn: 100946
OpenPOWER on IntegriCloud