summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Patch to support Gnu runtime's typed selectors.Fariborz Jahanian2009-05-051-1/+2
| | | | | | Patch by David Chisnall. llvm-svn: 71023
* Implement function-try-blocks. However, there's a very subtle bug that I ↵Sebastian Redl2009-04-261-1/+1
| | | | | | can't track down. llvm-svn: 70155
* split ObjC and C++ Statements out into their own headers.Chris Lattner2009-04-261-1/+1
| | | | llvm-svn: 70105
* Remove unnused variable.Daniel Dunbar2009-04-211-1/+0
| | | | llvm-svn: 69650
* Kill ASTContext::[gs]etFieldForDecl, instead we just lookup thingsDaniel Dunbar2009-04-211-5/+1
| | | | | | | | when we need them -- which is exactly what some code was already doing! - No intended functionality change. llvm-svn: 69648
* Remove non-const form of lookupFieldDeclForIvar.Daniel Dunbar2009-04-201-1/+1
| | | | llvm-svn: 69563
* Use EmitCallArgs in EmitObjCMessageExpr.Anders Carlsson2009-04-181-4/+1
| | | | llvm-svn: 69471
* FunctionDecl::getBody() is getting an ASTContext argument for use inDouglas Gregor2009-04-181-2/+2
| | | | | | | | lazy PCH deserialization. Propagate that argument wherever it needs to be. No functionality change, except that I've tightened up a few PCH tests in preparation. llvm-svn: 69406
* Attributes on block functions were not being set.Daniel Dunbar2009-04-171-1/+2
| | | | | | | - <rdar://problem/6800351> clang not producing correct large struct return code for Blocks llvm-svn: 69337
* Update to use hasAttr() instead of getAttr().Daniel Dunbar2009-04-131-1/+1
| | | | | | - No functionality change. llvm-svn: 68987
OpenPOWER on IntegriCloud