summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Fix for PR6811.David Chisnall2010-04-101-1/+1
| | | | llvm-svn: 100942
* Emit debug info for objc getters and setters.Devang Patel2010-04-051-3/+4
| | | | llvm-svn: 100462
* the big refactoring bits of PR3782.Rafael Espindola2010-03-301-3/+4
| | | | | | | | This introduces FunctionType::ExtInfo to hold the calling convention and the noreturn attribute. The next patch will extend it to include the regparm attribute and fix the bug. llvm-svn: 99920
* Replace some constant-sized SmallVectors.Benjamin Kramer2010-03-301-6/+7
| | | | llvm-svn: 99884
* Fix a code gen. bug involving generation of getter methodFariborz Jahanian2010-03-251-1/+6
| | | | | | from properties of _Complex type. (radar 7351147). llvm-svn: 99558
* Extend ObjCMessageExpr for class method sends with the source locationDouglas Gregor2010-03-081-1/+1
| | | | | | of the class name. llvm-svn: 97943
* Use getLocStart(), instead of getLocEnd(), to record starting location of ↵Devang Patel2010-02-151-1/+1
| | | | | | objc method. :) llvm-svn: 96245
* IRgen: Add CreateMemTemp, for creating an temporary memory object for a ↵Daniel Dunbar2010-02-091-9/+7
| | | | | | | | | | particular type, and flood fill. - CreateMemTemp sets the alignment on the alloca correctly, which fixes a great many places in IRgen where we were doing the wrong thing. - This fixes many many more places than the test case, but my feeling is we need to audit alignment systematically so I'm not inclined to try hard to test the individual fixes in this patch. If this bothers you, patches welcome! PR6240. llvm-svn: 95648
* Standardize the parsing of function type attributes in a way thatJohn McCall2010-02-051-3/+6
| | | | | | | | | | | | follows (as conservatively as possible) gcc's current behavior: attributes written on return types that don't apply there are applied to the function instead, etc. Only parse CC attributes as type attributes, not as decl attributes; don't accepet noreturn as a decl attribute on ValueDecls, either (it still needs to apply to other decls, like blocks). Consistently consume CC/noreturn information throughout codegen; enforce this by removing their default values in CodeGenTypes::getFunctionInfo(). llvm-svn: 95436
* IRgen: Fix some CreateTempAlloca calls to use ConvertTypeForMem when that isDaniel Dunbar2010-02-051-3/+4
| | | | | | conceptually correct. Review appreciated (Chris, Eli, Anders). llvm-svn: 95401
* Revert "Numerous changes to selector handling:", this breaks a whole bunch ofDaniel Dunbar2010-02-031-5/+1
| | | | | | working code, for no apparent reason. llvm-svn: 95244
* Numerous changes to selector handling:David Chisnall2010-02-031-1/+5
| | | | | | | | | | | | | | | | | | | | | | | - Don't use GlobalAliases with non-0 GEPs (GNU runtime) - this was unsupported and LLVM will be generating errors if you do it soon. This also simplifies the code generated by the GNU runtime a bit. - Make GetSelector() return a constant (GNU runtime), not a load of a store of a constant. - Recognise @selector() expressions as valid static initialisers (as GCC does). - Add methods to GCObjCRuntime to emit selectors as constants (needed for using @selector() expressions as constants. These need implementing for the Mac runtimes - I couldn't figure out how to do this, they seem to require a load. - Store an ObjCMethodDecl in an ObjCSelectorExpr so that we can get at the type information for the selector. This is needed for generating typed selectors from @selector() expressions (as GCC does). Ideally, this information should be stored in the Selector, but that would be an invasive change. We should eventually add checks for common uses of @selector() expressions. Possibly adding an attribute that can be applied to method args providing the types of a selector so, for example, you'd do something like this: - (id)performSelector: __attribute__((selector_types(id, SEL, id)))(SEL) withObject: (id)object; Then, any @selector() expressions passed to the method will be check to ensure that it conforms to this signature. We do this at run time on the GNU runtime already, but it would be nice to do it at compile time on all runtimes. - Made @selector() expressions emit type info if available and the runtime supports it. Someone more familiar with the Mac runtime needs to implement the GetConstantSelector() function in CGObjCMac. This currently just assert()s. llvm-svn: 95189
* Created __builtin___NSStringMakeConstantString() builtin, which generates ↵David Chisnall2010-01-231-1/+2
| | | | | | constant Objective-C strings. llvm-svn: 94274
* Pass ReturnValueSlot to EmitCall. No functionality change yet.Anders Carlsson2009-12-241-4/+4
| | | | llvm-svn: 92138
* Fix crash when synthesizing property setters when the property type and ivarDaniel Dunbar2009-10-271-5/+17
| | | | | | | type have mismatched Objective-C types. - <rdar://problem/7336352> [irgen] crash in synthesized property construction llvm-svn: 85275
* IRgen/ObjC: Make the target method decl available to GenerateMessageSendSuper.Daniel Dunbar2009-09-171-1/+3
| | | | llvm-svn: 82117
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-109/+106
| | | | llvm-svn: 81346
* Fixed a property getter ir-gen crash.Fariborz Jahanian2009-09-011-0/+1
| | | | llvm-svn: 80681
* Regularize the case and sort.Mike Stump2009-08-261-1/+1
| | | | llvm-svn: 80163
* Using "ObjCImplicitSetterGetterRefExpr" instead of ↵Fariborz Jahanian2009-08-201-4/+4
| | | | | | | | "ObjCImplctSetterGetterRefExpr". A field rename and more comments. llvm-svn: 79537
* Renamed ClassProp data member of ObjCImplctSetterGetterRefExprFariborz Jahanian2009-08-181-6/+6
| | | | | | | | to InterfaceDecl, as it is unrelated to any property and holds the InterfaceDecl needed for accessing class getter/setter methods using the dot-syntax. llvm-svn: 79371
* Renamed ObjCKVCRefExpr to ObjCImplctSetterGetterRefExpr.Fariborz Jahanian2009-08-181-2/+4
| | | | | | | | Removed an unnecessary loop to get to setters incoming argument. Added DoxyGen comments. Still more work to do in this area (WIP). llvm-svn: 79365
* Update for LLVM API change.Owen Anderson2009-07-311-2/+2
| | | | llvm-svn: 77722
* Canonicalize else spacing.Mike Stump2009-07-301-14/+7
| | | | llvm-svn: 77629
* Update for LLVM API change.Owen Anderson2009-07-291-1/+1
| | | | llvm-svn: 77492
* Update for LLVM API change.Owen Anderson2009-07-241-5/+5
| | | | llvm-svn: 77012
* Update for LLVM API change, and contextify a bunch of related stuff.Owen Anderson2009-07-141-8/+8
| | | | llvm-svn: 75705
* Update for LLVM API change.Owen Anderson2009-07-131-2/+2
| | | | llvm-svn: 75446
* This patch includes a conceptually simple, but very intrusive/pervasive change. Steve Naroff2009-07-101-2/+2
| | | | | | | | | | | | The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches. This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic. By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time. Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks. llvm-svn: 75314
* Remove the ASTContext parameter from the getBody() methods of Decl and ↵Argyrios Kyrtzidis2009-06-301-2/+2
| | | | | | | | subclasses. Timings showed no significant difference before and after the commit. llvm-svn: 74504
* Remove the ASTContext parameter from the attribute-related methods of Decl.Argyrios Kyrtzidis2009-06-301-1/+1
| | | | | | | | | The implementations of these methods can Use Decl::getASTContext() to get the ASTContext. This commit touches a lot of files since call sites for these methods are everywhere. I used pre-tokenized "carbon.h" and "cocoa.h" headers to do some timings, and there was no real time difference between before the commit and after it. llvm-svn: 74501
* Move the static DeclAttrs map into ASTContext. Fixes <rdar://problem/6983177>.Douglas Gregor2009-06-181-1/+1
| | | | llvm-svn: 73702
* Reflow some comments.Mike Stump2009-05-161-11/+11
| | | | llvm-svn: 71937
OpenPOWER on IntegriCloud