summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* DebugInfo can be enabled or disabled at function level (e.g. using an ↵Devang Patel2011-03-071-2/+2
| | | | | | attribute). However, at module level it is determined by command line option and the state of command line option does not change during compilation. Make this layering explicit and fix accidental cases where the code generator was checking whether module has debug info enabled instead of checking whether debug info is enabled for this function or not. llvm-svn: 127165
* Fix a typo.Dan Gohman2011-03-021-1/+1
| | | | llvm-svn: 126890
* Revert "Add CC_Win64ThisCall and set it in the necessary places."Tilmann Scheller2011-03-021-2/+1
| | | | | | This reverts commit 126863. llvm-svn: 126886
* Add CC_Win64ThisCall and set it in the necessary places.Tilmann Scheller2011-03-021-1/+2
| | | | llvm-svn: 126863
* Establish the iteration variable of an ObjC for-in loop beforeJohn McCall2011-02-221-7/+18
| | | | | | | emitting the collection expression. Fixes some really, really broken code. llvm-svn: 126193
* Objective-c armv7 API for atomic properties of Fariborz Jahanian2011-02-181-97/+135
| | | | | | scalar types. // rdar://7761305 llvm-svn: 125946
* Fix an IRGen bug in property setter calls whenFariborz Jahanian2011-02-081-1/+11
| | | | | | setter and getter types mismatch. // rdar://8966864 llvm-svn: 125125
* 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
OpenPOWER on IntegriCloud