summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Extend the ASTContext constructor to delay the initialization ofDouglas Gregor2011-09-021-2/+2
| | | | | | | | builtin types (When requested). This is another step toward making ASTUnit build the ASTContext as needed when loading an AST file, rather than doing so after the fact. No actual functionality change (yet). llvm-svn: 138985
* Be sure to emit lvalue-to-rvalue casts for loads from x-values.John McCall2011-08-301-24/+18
| | | | | | | Doing this happens to disrupt the pattern that ARC was looking for for move optimizations, so we need to fix that simultaneously. llvm-svn: 138789
* Track whether an AggValueSlot is potentially aliased, and do notJohn McCall2011-08-251-1/+2
| | | | | | | | | | emit call results into potentially aliased slots. This allows us to properly mark indirect return slots as noalias, at the cost of requiring an extra memcpy when assigning an aggregate call result into a l-value. It also brings us into compliance with the x86-64 ABI. llvm-svn: 138599
* Use stronger typing for the flags on AggValueSlot and requireJohn McCall2011-08-251-1/+3
| | | | | | | creators to tell us whether something needs GC barriers. No functionality change. llvm-svn: 138581
* Move the creation of the record type for the state of Objective-C fastDouglas Gregor2011-08-091-1/+1
| | | | | | | | enumerations from the ASTContext into CodeGen, so that we don't need to serialize it to AST files. This appears to be the last of the low-hanging fruit for SpecialTypes. llvm-svn: 137124
* The continue label in an ARC for-in loop should not involveJohn McCall2011-08-051-1/+4
| | | | | | releasing the collection. llvm-svn: 136949
* Use the general conditional-cleanup framework instead of rolling ourJohn McCall2011-08-031-45/+4
| | | | | | own, incorrectly, for releasing objects at the end of a full-expression. llvm-svn: 136823
* Remove some unnecessary single element array temporaries.Jay Foad2011-07-291-4/+2
| | | | llvm-svn: 136461
* Fix a couple of problems with initialization and assignment toJohn McCall2011-07-281-1/+11
| | | | | | | | | | | __block variables where the act of initialization/assignment itself causes the __block variable to be copied to the heap because the variable is of block type and is being assigned a block literal which captures the variable. rdar://problem/9814099 llvm-svn: 136337
* Clean up the analysis of the collection operand to ObjCJohn McCall2011-07-271-2/+20
| | | | | | | | | | | for-in statements; specifically, make sure to close over any temporaries or cleanups it might require. In ARC, this has implications for the lifetime of the collection, so emit it with a retain and release it upon exit from the loop. rdar://problem/9817306 llvm-svn: 136204
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-8/+8
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Document the existing objc_precise_lifetime attribute.John McCall2011-07-221-18/+68
| | | | | | | | | Introduce and document a new objc_returns_inner_pointer attribute, and consume it by performing a retain+autorelease on message receivers when they're not immediately loaded from an object with precise lifetime. llvm-svn: 135764
* In ARC, non-atomic getters do not need to retain and autoreleaseJohn McCall2011-07-221-17/+20
| | | | | | | their loaded values, although it still worth doing this for __weak properties to get the autoreleased-return-value optimization. llvm-svn: 135747
* Add a const overload for ObjCInterfaceDecl::all_declared_ivar_begin.Jordy Rose2011-07-221-3/+2
| | | | | | | | | This was previously not-const only because it has to lazily construct a chain of ivars the first time it is called (and after the chain is invalidated). In practice, all the clients were just const_casting their const Decls; all those now-unnecessary const_casts have been removed. llvm-svn: 135741
* de-constify llvm::Type, patch by David Blaikie!Chris Lattner2011-07-181-20/+20
| | | | llvm-svn: 135370
* Don't crash if defining -dealloc in a category.John McCall2011-07-131-3/+5
| | | | llvm-svn: 135054
* Generalize Cleanup::Emit's "isForEH" parameter into a setJohn McCall2011-07-121-6/+6
| | | | | | of flags. No functionality change. llvm-svn: 134997
* Switch field destruction over to use the new destroyer-based APIJohn McCall2011-07-121-276/+41
| | | | | | and kill a lot of redundant code. llvm-svn: 134988
* Do full-expression cleanups in a much more sensible way that still letsJohn McCall2011-07-121-33/+0
| | | | | | people write useful cleanup classes. llvm-svn: 134942
* clang side to match the LLVM IR type system rewrite patch.Chris Lattner2011-07-091-9/+9
| | | | llvm-svn: 134831
* A number of array-related IR-gen cleanups.John McCall2011-07-091-126/+45
| | | | | | | | | | | | - Emit default-initialization of arrays that were partially initialized with initializer lists with a loop, rather than emitting the default initializer N times; - support destroying VLAs of non-trivial type, although this is not yet exposed to users; and - support the partial destruction of arrays initialized with initializer lists when an initializer throws an exception. llvm-svn: 134784
* In ARC, reclaim all return values of retainable type, not just thoseJohn McCall2011-07-071-0/+8
| | | | | | | | | | | | where we have an immediate need of a retained value. As an exception, don't do this when the call is made as the immediate operand of a __bridge retain. This is more in the way of a workaround than an actual guarantee, so it's acceptable to be brittle here. rdar://problem/9504800 llvm-svn: 134605
* Change the driver's logic about Objective-C runtimes: abstract out aJohn McCall2011-07-061-8/+2
| | | | | | | | | | | | structure to hold inferred information, then propagate each invididual bit down to -cc1. Separate the bits of "supports weak" and "has a native ARC runtime"; make the latter a CodeGenOption. The tool chain is still driving this decision, because it's the place that has the required deployment target information on Darwin, but at least it's better-factored now. llvm-svn: 134453
* Update for llvm commit r134291.Eric Christopher2011-07-021-2/+2
| | | | | | Fixes rdar://9714064 llvm-svn: 134292
* Do not apply the ARC move optimization to 'const'-qualified xvalues.John McCall2011-06-251-1/+1
| | | | llvm-svn: 133861
* LValue carries a type now, so simplify the main EmitLoad/Store APIsJohn McCall2011-06-251-16/+12
| | | | | | by removing the redundant type parameter. llvm-svn: 133860
* Honor objc_precise_lifetime in GC mode by feeding the valueJohn McCall2011-06-241-0/+18
| | | | | | | in the variable to an inline asm which gets run when the variable goes out of scope. llvm-svn: 133840
* Change the IR-generation of VLAs so that we capture bounds,John McCall2011-06-241-13/+12
| | | | | | | not sizes; so that we use well-typed allocas; and so that we properly recurse through the full set of variably-modified types. llvm-svn: 133827
* Try to silence GCC warningDouglas Gregor2011-06-221-0/+2
| | | | llvm-svn: 133623
* Implement the C++0x move optimization for Automatic Reference CountingDouglas Gregor2011-06-221-0/+25
| | | | | | | | objects, so that we steal the retain count of a temporary __strong pointer (zeroing out that temporary), eliding a retain/release pair. Addresses <rdar://problem/9364932>. llvm-svn: 133621
* When binding a reference to an Automatic Reference Counting temporary,Douglas Gregor2011-06-221-4/+42
| | | | | | | | | retain/release the temporary object appropriately. Previously, we would only perform the retain/release operations when the reference would extend the lifetime of the temporary, but this does the wrong thing across calls. llvm-svn: 133620
* Remove dead variables.Benjamin Kramer2011-06-181-2/+0
| | | | llvm-svn: 133346
* Objective-C fast enumeration loop variables are not retained in ARC, butJohn McCall2011-06-171-3/+8
| | | | | | | | | | | | they should still be officially __strong for the purposes of errors, block capture, etc. Make a new bit on variables, isARCPseudoStrong(), and set this for 'self' and these enumeration-loop variables. Change the code that was looking for the old patterns to look for this bit, and change IR generation to find this bit and treat the resulting variable as __unsafe_unretained for the purposes of init/destroy in the two places it can come up. llvm-svn: 133243
* Automatic Reference Counting.John McCall2011-06-151-17/+1362
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Put local variables in appropriate debug info scope.Devang Patel2011-06-131-5/+5
| | | | | | This fixes radar 8757124. llvm-svn: 132949
* Implement Objective-C Related Result Type semantics.Douglas Gregor2011-06-111-23/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related result types apply Cocoa conventions to the type of message sends and property accesses to Objective-C methods that are known to always return objects whose type is the same as the type of the receiving class (or a subclass thereof), such as +alloc and -init. This tightens up static type safety for Objective-C, so that we now diagnose mistakes like this: t.m:4:10: warning: incompatible pointer types initializing 'NSSet *' with an expression of type 'NSArray *' [-Wincompatible-pointer-types] NSSet *array = [[NSArray alloc] init]; ^ ~~~~~~~~~~~~~~~~~~~~~~ /System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:72:1: note: instance method 'init' is assumed to return an instance of its receiver type ('NSArray *') - (id)init; ^ It also means that we get decent type inference when writing code in Objective-C++0x: auto array = [[NSMutableArray alloc] initWithObjects:@"one", @"two",nil]; // ^ now infers NSMutableArray* rather than id llvm-svn: 132868
* Fix location of setter/getter synthesized for a property.Devang Patel2011-05-191-7/+8
| | | | llvm-svn: 131701
* Use arrays and SmallVectors instead of std::vectors when building functionJohn McCall2011-05-151-5/+3
| | | | | | | types. Also, cache a translation of 'void' in CGM and provide a ptrdiff_t alias. No functionality change. llvm-svn: 131373
* Rename "hasTrivialConstructor" to "hasTrivialDefaultConstructor" andAlexis Hunt2011-05-091-1/+1
| | | | | | | modify the semantics slightly to accomodate default constructors (I hope). llvm-svn: 131087
* Simplify code a bit by using CallArgList::add. No intended functionality ↵Eli Friedman2011-05-021-37/+25
| | | | | | change. llvm-svn: 130699
* Refine rules for atomic property api toFariborz Jahanian2011-04-061-2/+17
| | | | | | | pass a previously failing clang test. // rdar://8808439 llvm-svn: 129004
* Fixes a regression caused by my last patch. Fariborz Jahanian2011-04-051-1/+2
| | | | | | | As a result, I had to remove a c++ version of a clang test which requires more scrutiny on my part. llvm-svn: 128950
* Generate atomic api for atomic properties (x86 and x86_64Fariborz Jahanian2011-04-051-8/+59
| | | | | | | targets) when load/store results in multiple instructions. // rdar://8808439 llvm-svn: 128937
* Fix IRGen issues related to using property-dot syntaxFariborz Jahanian2011-03-301-11/+3
| | | | | | for prperty reference types. // rdar://9208606. llvm-svn: 128551
* Remove PHINode::reserveOperandSpace(). Instead, add a parameter toJay Foad2011-03-301-4/+2
| | | | | | PHINode::Create() giving the (known or expected) number of operands. llvm-svn: 128538
* (Almost) always call reserveOperandSpace() on newly created PHINodes.Jay Foad2011-03-301-0/+2
| | | | llvm-svn: 128534
* Implements property of reference types. AddingFariborz Jahanian2011-03-281-5/+14
| | | | | | | an executable test to llvm test suite. // rdar://9070460. llvm-svn: 128435
* Make the property accessor functions that take a ptrdiff_t actually take a ↵David Chisnall2011-03-221-2/+4
| | | | | | ptrdiff_t instead of a long (should have no impact on any sane platforms, but win64 is not sane). llvm-svn: 128104
* The emission of an Objective-C++'s class .cxx_destruct method should beJohn McCall2011-03-221-38/+95
| | | | | | | conditioned on whether it has any destructible ivars, not on whether it has any non-trivial class-object initializers. llvm-svn: 128074
* Use the "undergoes default argument promotion" bit on parameters toJohn McCall2011-03-091-7/+5
| | | | | | | | | | simplify the logic of initializing function parameters so that we don't need both a variable declaration and a type in FunctionArgList. This also means that we need to propagate the CGFunctionInfo down in a lot of places rather than recalculating it from the FAL. There's more we can do to eliminate redundancy here, and I've left FIXMEs behind to do it. llvm-svn: 127314
OpenPOWER on IntegriCloud