summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Whether an argument is required (in contrast with being anJohn McCall2012-02-171-20/+31
| | | | | | | | | | | | | | | | | | | | | optional argument passed through the variadic ellipsis) potentially affects how we need to lower it. Propagate this information down to the various getFunctionInfo(...) overloads on CodeGenTypes. Furthermore, rename those overloads to clarify their distinct purposes, and make sure we're calling the right one in the right place. This has a nice side-effect of making it easier to construct a function type, since the 'variadic' bit is no longer separable. This shouldn't really change anything for our existing platforms, with one minor exception --- we should now call variadic ObjC methods with the ... in the "right place" (see the test case), which I guess matters for anyone running GNUStep on MIPS. Mostly it's just a substantial clean-up. llvm-svn: 150788
* Represent C++ direct initializers as ParenListExprs before semantic analysisSebastian Redl2012-02-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | instead of having a special-purpose function. - ActOnCXXDirectInitializer, which was mostly duplication of AddInitializerToDecl (leading e.g. to PR10620, which Eli fixed a few days ago), is dropped completely. - MultiInitializer, which was an ugly hack I added, is dropped again. - We now have the infrastructure in place to distinguish between int x = {1}; int x({1}); int x{1}; -- VarDecl now has getInitStyle(), which indicates which of the above was used. -- CXXConstructExpr now has a flag to indicate that it represents list- initialization, although this is not yet used. - InstantiateInitializer was renamed to SubstInitializer and simplified. - ActOnParenOrParenListExpr has been replaced by ActOnParenListExpr, which always produces a ParenListExpr. Placed that so far failed to convert that back to a ParenExpr containing comma operators have been fixed. I'm pretty sure I could have made a crashing test case before this. The end result is a (I hope) considerably cleaner design of initializers. More importantly, the fact that I can now distinguish between the various initialization kinds means that I can get the tricky generalized initializer test cases Johannes Schaub supplied to work. (This is not yet done.) This commit passed self-host, with the resulting compiler passing the tests. I hope it doesn't break more complicated code. It's a pretty big change, but one that I feel is necessary. llvm-svn: 150318
* simplify a bunch of code to use the well-known LLVM IR types computed by ↵Chris Lattner2012-02-071-2/+1
| | | | | | CodeGenModule. llvm-svn: 149943
* revert r149184Fariborz Jahanian2012-01-291-17/+3
| | | | llvm-svn: 149205
* objc-arc: Perform null check on receiver before sending methods whichFariborz Jahanian2012-01-281-3/+17
| | | | | | | | consume one or more of their arguments. If not done, this will cause a leak as method will not consume the argument when receiver is null. // rdar://10444474 llvm-svn: 149184
* Use function pointers, rather than references, to pass DestroyersPeter Collingbourne2012-01-261-4/+4
| | | | | | | around, in the process cleaning up the various gcc/msvc compiler workarounds. llvm-svn: 149036
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-201-1/+0
| | | | llvm-svn: 148577
* objc++: patch for IRgen for atomic properties ofFariborz Jahanian2012-01-101-34/+160
| | | | | | | c++ objects with non-trivial assignment/copy functions. Also, one additional sema check. // rdar://6137845 llvm-svn: 147817
* objc++: more atomic property api code forFariborz Jahanian2012-01-081-7/+15
| | | | | | c++ object properties. wip. llvm-svn: 147750
* objc++: More codegen stuff for atomic properties of c++ objectsFariborz Jahanian2012-01-071-7/+18
| | | | | | with non-trivial copies. // rdar://6137845 llvm-svn: 147735
* objc++: more code gen stuff for atomic property api,Fariborz Jahanian2012-01-061-13/+65
| | | | | | | | currently turned off. // rdar://6137845 Also, fixes a test case which should be nonatomic under new API. llvm-svn: 147691
* objc++: sythesize a helper function to be usedFariborz Jahanian2012-01-061-2/+89
| | | | | | | | for copying atomic properties of c++ objects with non-trivial copy assignment in setters/getters. Not yet used. // rdar://6137845 llvm-svn: 147636
* Fixes a code gen bug for setter code for a property ofFariborz Jahanian2012-01-051-1/+2
| | | | | | | | c++ object reference type with trivial copy constructor. This causes an assert crash and bad code gen. when assert is off. // rdar://6137845 llvm-svn: 147573
* Switch LValue so that it exposes alignment in CharUnits. (No functional ↵Eli Friedman2011-12-031-10/+5
| | | | | | change.) llvm-svn: 145753
* 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
OpenPOWER on IntegriCloud