summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Enter the cleanups for a block outside the enclosingJohn McCall2011-11-101-2/+5
| | | | | | | | | | | | full-expression. Naturally they're inactive before we enter the block literal expression. This restores the intended behavior that blocks belong to their enclosing scope. There's a useful -O0 / compile-time optimization that we're missing here with activating cleanups following straight-line code from their inactive beginnings. llvm-svn: 144268
* Rip out CK_GetObjCProperty.John McCall2011-11-071-16/+0
| | | | llvm-svn: 143910
* Rip the ObjCPropertyRef l-value kind out of IR-generation.John McCall2011-11-071-101/+0
| | | | llvm-svn: 143908
* Change the AST representation of operations on Objective-CJohn McCall2011-11-061-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | property references to use a new PseudoObjectExpr expression which pairs a syntactic form of the expression with a set of semantic expressions implementing it. This should significantly reduce the complexity required elsewhere in the compiler to deal with these kinds of expressions (e.g. IR generation's special l-value kind, the static analyzer's Message abstraction), at the lower cost of specifically dealing with the odd AST structure of these expressions. It should also greatly simplify efforts to implement similar language features in the future, most notably Managed C++'s properties and indexed properties. Most of the effort here is in dealing with the various clients of the AST. I've gone ahead and simplified the ObjC rewriter's use of properties; other clients, like IR-gen and the static analyzer, have all the old complexity *and* all the new complexity, at least temporarily. Many thanks to Ted for writing and advising on the necessary changes to the static analyzer. I've xfailed a small diagnostics regression in the static analyzer at Ted's request. llvm-svn: 143867
* Replace vectors with arrays.Benjamin Kramer2011-10-151-3/+1
| | | | llvm-svn: 142072
* Recommit:Eric Christopher2011-10-131-16/+8
| | | | | | | | | | | | | | | Start handling debug line and scope information better: Migrate most of the location setting within the larger API in CGDebugInfo and update a lot of callers. Remove the existing file/scope change machinery in UpdateLineDirectiveRegion and replace it with DILexicalBlockFile usage. Finishes off the rest of rdar://10246360 after fixing a few bugs that were exposed in gdb testsuite testing. llvm-svn: 141893
* Revert file/scope handling patches. gdb testing revealed a couple of bugs.Eric Christopher2011-10-121-8/+16
| | | | llvm-svn: 141796
* Start handling debug line and scope information better:Eric Christopher2011-10-111-16/+8
| | | | | | | | | | | Migrate most of the location setting within the larger API in CGDebugInfo and update a lot of callers. Remove the existing file/scope change machinery in UpdateLineDirectiveRegion and replace it with DILexicalBlockFile usage. Finishes off the rest of rdar://10246360 llvm-svn: 141732
* Mark calls to objc_retainBlock that don't result from castsJohn McCall2011-10-041-8/+48
| | | | | | to id so that we can still optimize them appropriately. llvm-svn: 141064
* Allow getting all source locations of selector identifiers in a ObjCMethodDecl.Argyrios Kyrtzidis2011-10-031-1/+1
| | | | | | | | | | | | | Instead of always storing all source locations for the selector identifiers we check whether all the identifiers are in a "standard" position; "standard" position is -Immediately before the arguments: -(id)first:(int)x second:(int)y; -With a space between the arguments: -(id)first: (int)x second: (int)y; -For nullary selectors, immediately before ';': -(void)release; In such cases we infer the locations instead of storing them. llvm-svn: 140989
* When performing an @throw in ARC, retain + autoreleaseJohn McCall2011-10-011-0/+24
| | | | | | | the pointer, being sure to do so before running cleanups associated with that full-expression. rdar://10042689 llvm-svn: 140945
* Change "Regions" to be "LexicalBlocks" since that's what theyEric Christopher2011-09-291-4/+4
| | | | | | correspond to. llvm-svn: 140740
* de-tmpify clang.Benjamin Kramer2011-09-271-2/+1
| | | | llvm-svn: 140637
* Turn off the generation of unaligned atomic load/store; I'm going to ↵Eli Friedman2011-09-131-1/+3
| | | | | | explicitly error out on such cases in the backend, at least for the moment. llvm-svn: 139640
* Refactoring, mostly to give ObjCPropertyDecls stronger invariants forJohn McCall2011-09-131-9/+8
| | | | | | their semantic attributes and then to take advantage of that. llvm-svn: 139615
* Switch LangOptions over to a .def file that describes header of theDouglas Gregor2011-09-131-4/+4
| | | | | | | | | | language options. Use that .def file to declare the LangOptions class and initialize all of its members, eliminating a source of annoying initialization bugs. AST serialization changes are next up. llvm-svn: 139605
* Don't use native atomics on ivars whose size is not a power of two,John McCall2011-09-131-0/+8
| | | | | | | | even on architectures that support unaligned access (which is the only way this is otherwise legal, given that ivars apparently do not honor alignment attributes). llvm-svn: 139590
* Handle reference properties correctly in the trivial-getter check.John McCall2011-09-131-2/+8
| | | | llvm-svn: 139585
* Always emit bitfield properties using expression behavior, even if they'reJohn McCall2011-09-131-0/+7
| | | | | | atomic. This is probably something we should warn about. llvm-svn: 139584
* Unify the decision of how to emit property getters and setters into aJohn McCall2011-09-131-205/+338
| | | | | | | | single code path. Use atomic loads and stores where necessary. Load and store anything of the appropriate size and alignment with primitive operations instead of going through the call. llvm-svn: 139580
* Privatize the setter/getter call generation methods, plus some minorJohn McCall2011-09-121-69/+70
| | | | | | modernization. No functionality change. llvm-svn: 139555
* Modernize and comment; no functionality change.John McCall2011-09-101-31/+27
| | | | llvm-svn: 139470
* Simplify the generation of Objective-C setters, at least a little.John McCall2011-09-101-132/+201
| | | | | | | | | Use a more portable heuristic for deciding when to emit a single atomic store; it's possible that I've lost information here, but I'm not sure how much of the logic before was intentionally arch-specific and how much was just not quite consistent. llvm-svn: 139468
* Rename the ARC cast kinds to start with "ARC".John McCall2011-09-101-8/+8
| | | | llvm-svn: 139466
* When converting a block pointer to an Objective-C pointer type, extendJohn McCall2011-09-101-0/+70
| | | | | | | | | | | the lifetime of the block by copying it to the heap, or else we'll get a dangling reference because the code working with the non-block-typed object will not know it needs to copy. There is some danger here, e.g. with assigning a block literal to an unsafe variable, but, well, it's an unsafe variable. llvm-svn: 139451
* Give conversions of block pointers to ObjC pointers a different cast kindJohn McCall2011-09-091-1/+2
| | | | | | | | than conversions of C pointers to ObjC pointers. In order to ensure that we've caught every case, add asserts to CastExpr that strictly determine which cast kind is used for which kind of bit cast. llvm-svn: 139352
* 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
OpenPOWER on IntegriCloud