Commit Graph

823 Commits

Author SHA1 Message Date
David Blaikie 0a21d0da17 PR14566: Debug Info: avoid top level lexical blocks in functions
One of the gotchas (see changes to CodeGenFunction) was due to the fix in
r139416 (for PR10829). This only worked previously because the top level
lexical block would set the location to the end of the function, the debug
location would be updated (as per r139416), the location would be set to
the end of the function again (but that would no-op, since it was the same
as the previous location), then the return instruction would be emitted using
the debug location.

Once the top level lexical block was no longer emitted, the end-of-function
location change was causing the debug loc to be updated, regressing that bug.

llvm-svn: 173593
2013-01-26 22:16:26 +00:00
Fariborz Jahanian c889205567 objC block layout: Patch reorders block layout to
produce more inline layout metadata. // rdar://12752901

llvm-svn: 172683
2013-01-17 00:25:06 +00:00
David Chisnall 2ec1b10d8e Enable the new (more C++-like, less broken) EH model when targeting the GNUstep
Objective-C runtime 1.7 or greater.

llvm-svn: 172207
2013-01-11 15:33:01 +00:00
Fariborz Jahanian cc2ae88e3c In my last patch initialize the destination to null (with a simple store) before doing a storeStrong to it.
// rdar://12530881

llvm-svn: 171572
2013-01-05 00:32:13 +00:00
Manman Ren cf15a4e97a Fix testing case for Release build (r171493)
rdar://11562117

llvm-svn: 171564
2013-01-05 00:01:42 +00:00
Fariborz Jahanian a82e9265d8 objective-C arc: in copy helper function for
__strong __block variables, perform objc_storeStrong on
source and destination instead of direct move. This 
is done with -O0 and to improve some analysis.
// rdar://12530881

llvm-svn: 171555
2013-01-04 23:32:24 +00:00
Manman Ren ab08a9adab Debug Info: fix the line location for cleanup code of a block function
The line information was changed when emitting debug information for all the
DeclRefExprs and we should change it back to get ready for PopClenupBlocks
called from FinishFunction.

rdar://11562117

llvm-svn: 171493
2013-01-04 18:51:35 +00:00
David Blaikie bf18725d11 Change this to an IR test instead of an assembly test (as per comment in r171134).
This makes the test not dependent on LLVM & won't vary/break based on LLVM
codegen related changes. Appropriately testing at the Clang level what was
fixed at the Clang level originally (in r124210).

llvm-svn: 171175
2012-12-28 01:16:31 +00:00
Eric Christopher a487035ca9 Update test for backend change.
TODO: This test should be moved to the backend.
llvm-svn: 171134
2012-12-27 02:20:24 +00:00
John McCall 393a78d4d3 Robustify the @encode code and add support for _Atomic.
Fixes PR14628.

llvm-svn: 170639
2012-12-20 02:45:14 +00:00
David Chisnall 0d75e0600b Reapply r170344, this time without forgetting to commit the header changes.
llvm-svn: 170354
2012-12-17 18:54:24 +00:00
Benjamin Kramer beea120d6e Revert "Added support for new property helpers (GNUstep runtime)."
This reverts commit r170344. Doesn't even compile.

llvm-svn: 170351
2012-12-17 18:02:43 +00:00
David Chisnall e99bc83fa5 Added support for new property helpers (GNUstep runtime).
llvm-svn: 170344
2012-12-17 15:59:29 +00:00
Chad Rosier 13799b323e Marking the objc_autoreleaseReturnValue and objc_retainAutoreleaseReturnValue
call sites as tail calls unconditionally.  While it's theoretically true that
this is just an optimization, it's an optimization that we very much want to
happen even at -O0, or else ARC applications become substantially harder to
debug.  See r169796 for the llvm/fast-isel side of things.
rdar://12553082

llvm-svn: 169996
2012-12-12 17:52:21 +00:00
Fariborz Jahanian f762b72f35 objective-C blocks: Check for record type when deciding if
byref variable requires extended layout info. to prevent 
a crash involving arrays declared __block. // rdar://12787751

llvm-svn: 169908
2012-12-11 19:58:01 +00:00
John McCall c818bbb8b2 Fix the required args count for variadic blocks.
We were emitting calls to blocks as if all arguments were
required --- i.e. with signature (A,B,C,D,...) rather than
(A,B,...).  This patch fixes that and accounts for the
implicit block-context argument as a required argument.
In addition, this patch changes the function type under which
we call unprototyped functions on platforms like x86-64 that
guarantee compatibility of variadic functions with unprototyped
function types;  previously we would always call such functions
under the LLVM type T (...)*, but now we will call them under
the type T (A,B,C,D,...)*.  This last change should have no
material effect except for making the type conventions more
explicit;  it was a side-effect of the most convenient implementation.

llvm-svn: 169588
2012-12-07 07:03:17 +00:00
NAKAMURA Takumi 3f2f792673 clang/test: Remove "REQUIRES:LP64" in two tests. Each of them have explicit triple.
llvm-svn: 169587
2012-12-07 06:57:40 +00:00
Chandler Carruth ff0e3a1e1c Rework the bitfield access IR generation to address PR13619 and
generally support the C++11 memory model requirements for bitfield
accesses by relying more heavily on LLVM's memory model.

The primary change this introduces is to move from a manually aligned
and strided access pattern across the bits of the bitfield to a much
simpler lump access of all bits in the bitfield followed by math to
extract the bits relevant for the particular field.

This simplifies the code significantly, but relies on LLVM to
intelligently lowering these integers.

I have tested LLVM's lowering both synthetically and in benchmarks. The
lowering appears to be functional, and there are no really significant
performance regressions. Different code patterns accessing bitfields
will vary in how this impacts them. The only real regressions I'm seeing
are a few patterns where the LLVM code generation for loads that feed
directly into a mask operation don't take advantage of the x86 ability
to do a smaller load and a cheap zero-extension. This doesn't regress
any benchmark in the nightly test suite on my box past the noise
threshold, but my box is quite noisy. I'll be watching the LNT numbers,
and will look into further improvements to the LLVM lowering as needed.

llvm-svn: 169489
2012-12-06 11:14:44 +00:00
Fariborz Jahanian 4cf177e238 objective-c blocks: Consider padding due to alignment
after the fixed size block header when generating
captured block variable info. // rdar://12773256

llvm-svn: 169285
2012-12-04 17:20:57 +00:00
Fariborz Jahanian 998f0a3360 objective-C blocks: Make sure that identical logic is used
in deciding a copy/dispose field is needed in a byref structure
and when generating the copy/dispose helpers. In certain
cases, these fields were being added but no copy/dispose was
being generated. This was uncovered in ARC, but not in MRR.
// rdar://12759433

llvm-svn: 168825
2012-11-28 23:12:17 +00:00
Fariborz Jahanian fbd19749a3 objective-C arc: load of a __weak object happens via call to
objc_loadWeak. This retains and autorelease the weakly-refereced
object. This hidden autorelease sometimes makes __weak variable alive even
after the weak reference is erased, because the object is still referenced
by an autorelease pool. This patch overcomes this behavior by loading a 
weak object via call to objc_loadWeakRetained(), followng it by objc_release
at appropriate place, thereby removing the hidden autorelease. // rdar://10849570

llvm-svn: 168740
2012-11-27 23:02:53 +00:00
Fariborz Jahanian 0e3043b2ed block extended signatur option. Change previous option
to a cc1 -fencode-extended-block-signature and pass it
to cc1 and recognize this option to produce extended block
type signature. // rdar://12109031 

llvm-svn: 168063
2012-11-15 19:02:45 +00:00
Fariborz Jahanian a4ca19694e objective-C blocks: make cc1 flag -encode-extended-block-signature
the default. // rdar://12109031

llvm-svn: 168007
2012-11-15 00:01:28 +00:00
Fariborz Jahanian 64223e6db1 objective-C blocks: under cc1 flag -encode-extended-block-signature,
generate expanded signature encoding to include types as we
already do this for protocol method lists.
// rdar://12109031

llvm-svn: 167997
2012-11-14 23:11:38 +00:00
Fariborz Jahanian a9d4464baf objective-C blocks: Provide layout map for byref
variables captured in a block. // rdar://12184410

llvm-svn: 167931
2012-11-14 17:15:51 +00:00
Fariborz Jahanian e14f98e0bc objective-C blocks: Change BLOCK_HAS_EXTENDED_LAYOUT to be 1<<31.
lower 24bit is currently being used.

llvm-svn: 167678
2012-11-10 18:30:40 +00:00
David Chisnall 9a837be2b9 Fix the Objective-C exception rethrow from cleanups (GNU runtimes). Note that
a bug in the inliner still causes the wrong thing to happen at -O2 and above
(PR14116).

llvm-svn: 167534
2012-11-07 16:50:40 +00:00
Eli Friedman 8593748ed5 Put something sane in the DWARF offset field for bitfield ObjC ivars.
This is useful because unnamed bitfields can have effects on the
offsets which are not otherwise reflected in the DWARF information.

<rdar://problem/12629719>

llvm-svn: 167503
2012-11-06 23:40:48 +00:00
Eli Friedman 1e83d6f612 Fix a silly mistake in r167437.
llvm-svn: 167487
2012-11-06 21:10:22 +00:00
Eli Friedman b201e4d6ab Minor fix to ObjC layout bitmap metadata. Found while I was trying to
refactor the code.

llvm-svn: 167436
2012-11-06 03:38:02 +00:00
Fariborz Jahanian 5f04d84459 Tests for 32bit version of block ivar layout metadata.
llvm-svn: 167387
2012-11-05 18:14:34 +00:00
Fariborz Jahanian 2c96d30dd8 Fixes liftime of captured block variables in mrr mode, per John's feedback, as
well as couple of tests which were not being excercised because of TYPOs.

llvm-svn: 167374
2012-11-04 18:19:40 +00:00
David Blaikie c59571878c Simplify these tests again, now that we're past the version skew.
llvm-svn: 167346
2012-11-03 00:27:14 +00:00
David Blaikie 263f6a0ffa Avoid version skew by making ObjC strict metadata tests resilient to new field.
llvm-svn: 167332
2012-11-02 23:07:41 +00:00
Fariborz Jahanian 2dd7819267 objective-C mrr block. Block variable layout metadata in
mrr mode.

llvm-svn: 167331
2012-11-02 22:51:18 +00:00
Quentin Colombet 4e172067b2 Update the front end to use minsize attribute
llvm-svn: 167266
2012-11-01 23:55:47 +00:00
Fariborz Jahanian 23290b0570 objective-C block meta-data. This patch completes meta-data
generation for captured block variables in arc mode. This includes
inlined version of the meta-data when it can be done. It also includes
severat tests. This is wip. // rdar://12184410.

llvm-svn: 167241
2012-11-01 18:32:55 +00:00
Eli Friedman 0e84602d5c Don't crash synthesizing an ObjC property with an empty struct type. <rdar://problem/12547611>.
llvm-svn: 166825
2012-10-26 22:38:05 +00:00
David Tweed d8bb236e18 Correct test inovocations to use %clang_cc1 rather than direct invocation (so that it can have additional options set when trying to debug issues causing regressions).
llvm-svn: 166681
2012-10-25 13:56:30 +00:00
Ulrich Weigand 35668cc401 A number of test cases assume that an "int" parameter or return value
will be represented in the IR as a plain "i32" type.  This causes the
tests to spuriously fail on platforms where int is not a 32-bit type,
or where the ABI requires attributes like "signext" or "zeroext" to
be used.

This patch adds -triple or -target parameters to force those tests
to use the i386-unknown-unknown target.

llvm-svn: 166551
2012-10-24 12:22:56 +00:00
NAKAMURA Takumi f1f6e99c53 Revert r166541, "clang/test: Add appropriate requirements as REQUIRES, corresponding to r166532."
According to r166543, it is not needed for now.

llvm-svn: 166544
2012-10-24 03:59:09 +00:00
NAKAMURA Takumi a22fe582d2 clang/test: Add appropriate requirements as REQUIRES, corresponding to r166532.
llvm-svn: 166541
2012-10-24 02:57:57 +00:00
John McCall 0d54a17b52 Set a special flag in class metadata when an Objective-C class
has ivars that require destruction, but none that require anything
except zero-initialization.  This is common in ARC and (when true
throughout a class hierarchy) permits the elimination of an
unnecessary message-send during allocation.

llvm-svn: 166088
2012-10-17 04:53:31 +00:00
John McCall e68b8f4dcc At -O0, prefer objc_storeStrong with a null new value to the
combination of a load+objc_release;  this is generally better
for tools that try to track why values are retained and
released.  Also use objc_storeStrong when copying a block
(again, only at -O0), which requires us to do a preliminary
store of null in order to compensate for objc_storeStrong's
assign semantics.

llvm-svn: 166085
2012-10-17 02:28:37 +00:00
David Chisnall a5f5941374 GNUstep runtime version default to 1.6, generate correct property attribute
metadata.

llvm-svn: 166023
2012-10-16 15:11:55 +00:00
Daniel Dunbar bd847cc562 Un-revert r164907 and r164902 (+ follow-ups), 10.6 build fix to follow.
llvm-svn: 165988
2012-10-15 22:23:53 +00:00
Nico Weber bec2bf1326 Revert r164907 and r164902 (+ follow-ups). They broke building on 10.6.
See PR14013.

llvm-svn: 165962
2012-10-15 20:37:01 +00:00
Fariborz Jahanian 27678b0961 objective-C IRgen: When sending a method to 'super'
in a category class method, don't read 'isa' pointer. Instead,
save the desired OBJC_METACLASS_$_ClassName in 
__DATA,__objc_superrefs and read that without reading any 
isa pointers. // rdar://12459358

llvm-svn: 165674
2012-10-10 23:11:18 +00:00
Eli Friedman 9018ef709e Make sure to generate the right kind of MDNode for enum forward declarations.
PR14029, clang part.

llvm-svn: 165289
2012-10-05 01:49:33 +00:00
Chandler Carruth 01f63b950c Re-enable this test to reflect re-enabling the new SROA pass.
llvm-svn: 164987
2012-10-02 04:24:16 +00:00
Bob Wilson 2afa011e0b Add Clang support for iOS6.
llvm-svn: 164907
2012-09-29 23:52:58 +00:00
Nick Lewycky 2099bbb24b Turn off this test, as the new and old SROA cause it produce different output.
Left in a note that we need to turn it back on once the SROA fallout is cleared
up.

llvm-svn: 164733
2012-09-26 22:48:46 +00:00
John McCall b0433eeb2e During jump-scope checking, build an ExprWithCleanups immediately
into the enclosing scope;  this is a more accurate model but is
(I believe) unnecessary in my test case due to other flaws.
However, one of those flaws is now intentional:  blocks which
appear in return statements can be trivially observed to not
extend in lifetime past the return, and so we can allow a jump
past them.  Do the necessary magic in IR-generation to make
this work.

llvm-svn: 164589
2012-09-25 06:56:03 +00:00
Chandler Carruth ed2a284977 Update the Clang tests which run with a full optimization pipeline for
the new SROA pass. This is a benign change: the order of PHI nodes
changed.

llvm-svn: 164481
2012-09-24 01:10:25 +00:00
Benjamin Kramer a73727143a Disable some tests that fail when the x86 backend isn't built.
llvm-svn: 164122
2012-09-18 13:34:01 +00:00
Eric Christopher 31ce693f93 Reapply:
Make clang emit a flag for DW_AT_object_pointer for the artificial
    args where it should (implicit first arguments). FileCheck-ize a
    test as well and update tests to take into account the object
    pointer flag.

    rdar://9797999

llvm-svn: 163755
2012-09-12 23:36:49 +00:00
Eric Christopher 48f782bbd2 Revert "Make clang emit a flag for DW_AT_object_pointer for the artificial"
this should be done on the subprogram, not the variable.

llvm-svn: 163733
2012-09-12 18:42:10 +00:00
NAKAMURA Takumi cb0a08ac77 clang/test: [PR13820] Suppress LLP64-incompatible tests for ObjC with +Asserts.
llvm-svn: 163709
2012-09-12 14:26:42 +00:00
NAKAMURA Takumi f331aa9c00 clang/test/CodeGenObjC: [PR13820] Suppress LLP64-incompatible tests.
llvm-svn: 163701
2012-09-12 10:45:52 +00:00
NAKAMURA Takumi fcd16e36c8 clang/test: [PR8833] Introduce the feature "LP64" to suppress LLP64-incompatible tests.
I think some of them could be rewritten to fit also LLP64.

llvm-svn: 163699
2012-09-12 10:45:40 +00:00
Eric Christopher 1d292e59d3 Make clang emit a flag for DW_AT_object_pointer for the artificial
args where it should (implicit first arguments). FileCheck-ize a
test as well and update tests to take into account the object
pointer flag.

rdar://9797999

llvm-svn: 163668
2012-09-12 00:27:32 +00:00
John McCall cfa4e9bdf3 In ARC, if we're emitting assembly markers for calls to
objc_retainAutoreleasedReturnValue, we need to also be killing
them during return peepholing.  Make sure we recognize an
intervening bitcast, but more importantly, assert if we can't
find the asm marker at all.  rdar://problem/12133032

llvm-svn: 163431
2012-09-07 23:30:50 +00:00
Aaron Ballman 9c00446d2a Fixing the return type information for objc_sync_enter and objc_sync_exit. Patch thanks to Joe Ranieri!
llvm-svn: 163330
2012-09-06 16:44:16 +00:00
Eli Friedman 8087378f09 Fix PR reference in test.
llvm-svn: 162866
2012-08-29 21:27:50 +00:00
Eli Friedman 9a38121fc5 Fix run-line for test.
llvm-svn: 162865
2012-08-29 21:25:58 +00:00
Eli Friedman 504f9a2872 Make alignment computation for pointer values for builtins handle
non-pointer types with a pointer representation correctly. PR13660.

llvm-svn: 162862
2012-08-29 21:21:11 +00:00
John McCall 986a992400 Restore a -cc1 invariant that was causing problems on PPC64.
This test case is pretty bad, though.

llvm-svn: 162694
2012-08-27 19:56:37 +00:00
John McCall d8561f058d Fix a pair of bugs relating to properties in ARC.
First, when synthesizing an explicitly strong/retain/copy property
of Class type, don't pretend during compatibility checking that the
property is actually assign.  Instead, resolve incompatibilities
by secretly changing the type of *implicitly* __unsafe_unretained
Class ivars to be strong.  This is moderately evil but better than
what we were doing.

Second, when synthesizing the setter for a strong property of
non-retainable type, be sure to use objc_setProperty.  This is
possible when the property is decorated with the NSObject
attribute.  This is an ugly, ugly corner of the language, and
we probably ought to deprecate it.

The first is rdar://problem/12039404;  the second was noticed by
inspection while fixing the first.

llvm-svn: 162244
2012-08-20 23:36:59 +00:00
Benjamin Kramer e0b3f44ffc Fix broken check lines.
llvm-svn: 162096
2012-08-17 12:28:21 +00:00
Fariborz Jahanian af264ce12a objc-arc: set nonlazybind attribute on objc_retain/
objc_release for performance for these most often
called APIs. // rdar://12040837

llvm-svn: 161448
2012-08-07 21:30:31 +00:00
Eric Christopher ec21f68740 Don't need to specify the abi as it's the default.
rdar://11842763

llvm-svn: 160554
2012-07-20 17:42:31 +00:00
Eric Christopher 4bbb3c459e FileCheck-ize.
llvm-svn: 160528
2012-07-19 22:22:58 +00:00
Eric Christopher 7457aaf8c9 Reset the layout of an ObjC class if we see an ivar in a category
or implementation since we've now got a different layout.

Fixes rdar://11842763

llvm-svn: 160526
2012-07-19 22:22:51 +00:00
John McCall 775086e67c Add the ObjFW runtime. Patch by Jonathan Schleifer!
llvm-svn: 160102
2012-07-12 02:07:58 +00:00
David Chisnall b601c96892 Rename the GCC Objective-C runtime to gcc from gnu-fragile and the GNUstep
runtime to gnustep from gnu.  Fix EH for the GCC runtime.

llvm-svn: 159684
2012-07-03 20:49:52 +00:00
Fariborz Jahanian 271b8d43ce objective-c IRGen: fixes a crash when method type is being mangled
when an argument type size is 0. // rdar://11777609, PR13229

llvm-svn: 159472
2012-06-29 22:54:56 +00:00
Fariborz Jahanian 6362803cfe block literal irgen: several improvements on naming block
literal helper functions. All helper functions (global
and locals) use block_invoke as their prefix. Local literal
helper names are prefixed by their enclosing mangled function
names. Blocks in non-local initializers (e.g. a global variable 
or a C++11 field) are prefixed by their mangled variable name. 
The descriminator number added to end of the name starts off 
with blank (for first block) and _<N> (for the N+2-th block).

llvm-svn: 159206
2012-06-26 16:06:38 +00:00
John McCall 5fb5df9c83 Restructure how the driver communicates information about the
target Objective-C runtime down to the frontend:  break this
down into a single target runtime kind and version, and compute
all the relevant information from that.  This makes it
relatively painless to add support for new runtimes to the
compiler.  Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z,
available at the driver level as a better and more general
alternative to -fgnu-runtime and -fnext-runtime.  This new
concept of an Objective-C runtime also encompasses what we
were previously separating out as the "Objective-C ABI", so
fragile vs. non-fragile runtimes are now really modelled as
different kinds of runtime, paving the way for better overall
differentiation.

As a sort of special case, continue to accept the -cc1 flag
-fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak.

I won't go so far as to say "no functionality change", even
ignoring the new driver flag, but subtle changes in driver
semantics are almost certainly not intended.

llvm-svn: 158793
2012-06-20 06:18:46 +00:00
Fariborz Jahanian a36cbeb464 objc-arc: captured block variable accessed in its block literal
initializer need be null initialized before initializer takes
hold, just like any other initialized retainable object pointer. 
// rdar://11016025

llvm-svn: 158738
2012-06-19 20:53:26 +00:00
Fariborz Jahanian b5dd2cb13c objective-c: fix a sema and IRGen crash when property
getter result type is safe but does not match with property 
type resulting in spurious warning followed by crash in
IRGen. // rdar://11515196

llvm-svn: 157641
2012-05-29 19:56:01 +00:00
Argyrios Kyrtzidis da6d7679e8 Add documentation about boxing enum types and a codegen test to make
sure we pick up the underlying type, per suggestion by Fariborz.

No functionality change.

llvm-svn: 156851
2012-05-15 20:45:35 +00:00
Jordy Rose 0b9cfa2b06 Test for -fdebugger-objc-literal: missing methods should be generated like missing classes.
llvm-svn: 156746
2012-05-13 20:36:47 +00:00
Argyrios Kyrtzidis 74d7f15aed Add a test case for going through typedefs until we reach "BOOL", that NSAPI::isObjCTypedef() is doing.
llvm-svn: 156604
2012-05-11 01:53:27 +00:00
Argyrios Kyrtzidis 6062da47b8 [objc] When boxing a BOOL/NSInteger/NSUInteger type, use the corresponding
numberWithBool:/numberWithInteger:/numberWithUnsignedInteger: NSNumber selectors.

rdar://11428703

llvm-svn: 156583
2012-05-10 23:12:03 +00:00
Fariborz Jahanian 2faa82d4b8 Test case for previosu patch.
// rdar://11323676

llvm-svn: 155664
2012-04-26 21:34:02 +00:00
Eric Christopher 3cc207bbcc Forward declarations should take a context. This helps the debugger
find forward declarations in the context that the actual definition
will occur.

rdar://11291658

llvm-svn: 155381
2012-04-23 19:00:24 +00:00
Fariborz Jahanian 440b524b46 minor improvement to couple of tests.
llvm-svn: 155204
2012-04-20 17:07:07 +00:00
Patrick Beard 0caa39474b Implements boxed expressions for Objective-C. <rdar://problem/10194391>
llvm-svn: 155082
2012-04-19 00:25:12 +00:00
Eric Christopher 56ef374611 The copy and destroy helper functions aren't prototyped, don't call them
so.

llvm-svn: 154569
2012-04-12 00:35:04 +00:00
Eric Christopher 03c50998cb Add a triple to this test.
llvm-svn: 154485
2012-04-11 07:08:37 +00:00
Eric Christopher d79e19ea84 Try to fix the windows buildbots by making this test a little less
dependent upon metadata ordering.

llvm-svn: 154482
2012-04-11 06:09:33 +00:00
Eric Christopher 3d19de9910 Enable debug info for objective c implementations that may not have
an explicit instance variable.

rdar://10590352

llvm-svn: 154481
2012-04-11 05:56:05 +00:00
David Chisnall 58464d0fe1 Revert r154321, pending more discussion.
llvm-svn: 154327
2012-04-09 17:25:11 +00:00
David Chisnall 4ec2af2fab Add -fobjc-trace to emit a call before and after each Objective-C message send
for hooking in code flow visualisation applications.  

llvm-svn: 154321
2012-04-09 15:42:15 +00:00
Eric Christopher c465ce9e79 Enhance testing a bit to make sure that we're omitting the
getter and setter when they're synthesized with the default
names.

rdar://11179756

llvm-svn: 154130
2012-04-05 22:03:35 +00:00
Eric Christopher f3dd713bce Only emit the getter and setter names if they're not the default
synthesized ones. Reasonable debug info size reduction for objc.

rdar://11179756

llvm-svn: 154129
2012-04-05 22:03:32 +00:00
John McCall 3abee49d1c Enter an expression evaluation context when parsing
statement-expressions.  Prevents cleanups and such from being
claimed by the first full-expression in the block.

llvm-svn: 153989
2012-04-04 01:27:53 +00:00
Eric Christopher b7e821a6aa Change location information for synthesized properties to be at the
property file/line rather than the @synthesize file/line. Avoids
some nasty confusing-ness with conflating the file from the scope
and the line from the original declaration. Use    the current scope
location as a separate parameter so that we can    match it up
better in the line table with the beginning of the scope.

Update a couple of testcases accordingly since I had to change
that we actually use the passed in location in EmitFunctionStart
and for the new metadata parameter and add a new testcase to
make sure we've got the right line numbers for synthesized
properties.

Part of rdar://11026482

llvm-svn: 153917
2012-04-03 00:44:15 +00:00
Eric Christopher fef37f81b4 Revert previous commit changing location information to see if this
is causing the gdb test failures on the bots.

llvm-svn: 153727
2012-03-30 05:42:12 +00:00
Eli Friedman 410fc7ae89 Make sure we perform the relevant implied conversions correctly for ObjC methods with related result types. PR12384.
llvm-svn: 153716
2012-03-30 01:13:43 +00:00
Eric Christopher f4d006348b Testcase for the previous commit.
llvm-svn: 153715
2012-03-30 01:07:51 +00:00
Eric Christopher df02b36a2c Change location information for synthesized properties to be at the
property file/line rather than the @synthesize file/line. Avoids
some nasty confusing-ness with conflating the file from the scope
and the line from the original declaration.

Update a couple of testcases accordingly since I had to change
that we actually use the passed in location in EmitFunctionStart.

Fixes rdar://11026482

llvm-svn: 153714
2012-03-30 01:07:48 +00:00
Bill Wendling 82b87f19e2 The UTF16 string referenced by a CFString should go into the __TEXT,__ustring
section. A 'normal' string will go into the __TEXT,__const section, but this
isn't good for UTF16 strings. The __ustring section allows for coalescing, among
other niceties (such as allowing the linker to easily split up strings).

Instead of outputting the UTF16 string as a series of bytes, output it as a
series of shorts. The back-end will then nicely place the UTF16 string into the
correct section, because it's a mensch.
<rdar://problem/10655949>

llvm-svn: 153710
2012-03-30 00:26:17 +00:00
Eric Christopher bd9c910c8c Go back to using just the selector name for the getter and setter
in the property debug info. Any more isn't necessary after all.

rdar://11144023

llvm-svn: 153659
2012-03-29 17:31:33 +00:00
Eric Christopher eb03169b9a Add support for objc property decls according to the page at:
http://llvm.org/docs/SourceLevelDebugging.html#objcproperty

    including type and DECL. Expand the getter and setter names
    into the fully qualified names.

    rdar://11144023

llvm-svn: 153640
2012-03-29 08:43:37 +00:00
Ted Kremenek e65b086e07 Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,
NSNumber, and boolean literals.  This includes both Sema and Codegen support.
Included is also support for new Objective-C container subscripting.

My apologies for the large patch.  It was very difficult to break apart.
The patch introduces changes to the driver as well to cause clang to link
in additional runtime support when needed to support the new language features.

Docs are forthcoming to document the implementation and behavior of these features.

llvm-svn: 152137
2012-03-06 20:05:56 +00:00
Fariborz Jahanian e5d9b0b8c8 Test is fixed.
llvm-svn: 151280
2012-02-23 20:43:56 +00:00
Fariborz Jahanian 1e2303379d XFAIL test until I figure out how to make test pass on different platforms.
llvm-svn: 151277
2012-02-23 20:22:21 +00:00
Fariborz Jahanian 7cef65a3b6 Change test again so it passes in build-bot until I can figure out what is
going on.

llvm-svn: 151275
2012-02-23 20:07:38 +00:00
Fariborz Jahanian b96a293a59 fix test for patch in r151268.
llvm-svn: 151272
2012-02-23 18:57:03 +00:00
Fariborz Jahanian 2f0de8bdb9 objective-c default synthesis. classes which adopt protocol properties
must still auto synthesize those propeties which have been redeclared 
in the class. // rdar://10907410

llvm-svn: 151268
2012-02-23 18:21:25 +00:00
Eli Friedman 91f5ae5022 Try to handle qualifiers more consistently for array InitListExprs. Fixes <rdar://problem/10907510>, and makes the ASTs a bit more self-consistent.
(I've chosen to keep the qualifiers, but it isn't a strong preference; if anyone prefers removing them, please yell.)

llvm-svn: 151229
2012-02-23 02:25:10 +00:00
Eli Friedman 91d5bb1ee5 Make sure null initialization in arrays works correctly with ARC types. <rdar://problem/10907547>.
llvm-svn: 151133
2012-02-22 05:38:59 +00:00
Fariborz Jahanian caabf1bb64 objc IRGen: force CSE of load of ivar offsets by setting
the 'invariant.load' metadata tag onto those loads.
// rdar://10840980

llvm-svn: 150994
2012-02-20 22:42:22 +00:00
Chad Rosier 112e71ee7c Make test case less sensitive to metadata numbering.
llvm-svn: 150983
2012-02-20 19:51:44 +00:00
Eric Christopher 66562a4a54 Remove the type retaining from the clang frontend. This is now
handled by the caching and rauw. Also fix one cache that wasn't
being added to highlighted by this patch. Update all testcases
accordingly.

This should fix the deall failure.

llvm-svn: 150977
2012-02-20 18:05:24 +00:00
John McCall a729c62b81 Whether an argument is required (in contrast with being an
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
2012-02-17 03:33:10 +00:00
Dan Gohman 7537838499 Fix this test to work with and without Asserts mode.
llvm-svn: 150713
2012-02-16 18:51:05 +00:00
Bill Wendling 75ff46d917 Fix test to not depend upon metadata numbers.
llvm-svn: 150668
2012-02-16 08:58:11 +00:00
NAKAMURA Takumi 59b1bc16eb test/CodeGenObjC/arc-no-arc-exceptions.m: Disable it at -Asserts for now.
llvm-svn: 150666
2012-02-16 08:12:12 +00:00
Chad Rosier ffbf9f1406 Fix test for r150648.
llvm-svn: 150650
2012-02-16 01:56:55 +00:00
Bill Wendling b6f795eee6 Use the new method for specifying garbage collection metadata in the module.
The garbage collection metadata needs to be merged "intelligently", when two or
more modules are linked together, and not merely appended. (Appending creates a
section which is too large.) The module flags metadata method is the way to do
this.
<rdar://problem/8198537>

llvm-svn: 150648
2012-02-16 01:13:30 +00:00
Dan Gohman 515a60daff Teach clang to add metadata tags to calls and invokes in ObjC with
-fno-objc-arc-exceptions. This will allow the optimizer to perform
optimizations which are only safe under that flag.

This is a part of rdar://10803830.

llvm-svn: 150644
2012-02-16 00:57:37 +00:00
Fariborz Jahanian 430b35edf8 objc-arc: For arc's ivar layout, treat __unsafe_unretained ivars
as unscanned. // rdar://10832643

llvm-svn: 150639
2012-02-16 00:15:02 +00:00
Devang Patel 37a5c9564d Emit debug info for properites that are not backed by an ivar.
llvm-svn: 149995
2012-02-07 18:40:30 +00:00
Devang Patel f93d0b8b28 Relax valid location check. This fixes a clang crash while emitting debug info for properties that are synthesized by the compiler by default.
llvm-svn: 149929
2012-02-06 23:24:13 +00:00
Devang Patel 60fc242545 Let an ivar directly refer property TAG.
llvm-svn: 149881
2012-02-06 18:20:02 +00:00
Richard Smith 5d8e7593e3 Unbreak failing test added in r149738.
llvm-svn: 149766
2012-02-04 05:33:36 +00:00
Devang Patel c047c4d15b New test case.
llvm-svn: 149738
2012-02-04 01:30:45 +00:00
Devang Patel fb04ece198 Update tests so that they don't rely upon LLVMDebugVersion number.
llvm-svn: 149726
2012-02-03 23:58:39 +00:00
Fariborz Jahanian 97795c8872 fix test.
llvm-svn: 149313
2012-01-31 01:05:11 +00:00
Fariborz Jahanian c93fa98e4c test for a v-table dispatch that consumes an
argument. twik to support the test case.
// rdar://10444476

llvm-svn: 149298
2012-01-30 23:39:30 +00:00
Fariborz Jahanian f2bda69cd2 objc-arc: Perform null check on receiver before sending methods which
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.
In this patch, the null path releases consumed argument.
// rdar://10444474

llvm-svn: 149279
2012-01-30 21:40:37 +00:00
Fariborz Jahanian 715fdd53a6 revert r149184
llvm-svn: 149205
2012-01-29 20:27:13 +00:00
John McCall ffa2c1a48e When emitting an ARC epilogue that looks like a return of 'self',
kill the retain from the return site.

This has the workaround nature.  It's badness all around.

llvm-svn: 149193
2012-01-29 07:46:59 +00:00
John McCall 6e1c012385 Get a little bit smarter about killing off the ReturnValue alloca
in the presence of straight-line cleanups.  This is a simple but
important case, particularly for ARC.

llvm-svn: 149190
2012-01-29 02:35:02 +00:00
Fariborz Jahanian 326efeb95a objc-arc: Perform null check on receiver before sending methods which
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
2012-01-28 18:46:31 +00:00
John McCall 9701731a3e When initializing a catch variable in ARC, be sure to emit retains
or whatever else is required for the initialization instead of
assuming it can be done with a simple store.

Fixes PR11732.

llvm-svn: 148325
2012-01-17 20:16:56 +00:00
David Chisnall 207a630052 Restore r147493 and remove the part of the test that was checking the wrong thing.
llvm-svn: 147530
2012-01-04 12:02:13 +00:00
Douglas Gregor 64d9257e38 When performing layout for an Objective-C class, make sure to dig out
the definition of that class. Fixes PR11613 / <rdar://problem/10604077>.

llvm-svn: 146976
2011-12-20 15:50:13 +00:00
Devang Patel fbfd303dc4 Update tests to match r146744.
llvm-svn: 146745
2011-12-16 17:56:38 +00:00
Devang Patel 40b88d6756 Update tests to match r146665.
llvm-svn: 146668
2011-12-15 18:03:43 +00:00
John McCall e5e1b88bbc Fix an extremely stupid bug causing terrible miscompilations
of &= on pseudo-objects.

llvm-svn: 145904
2011-12-06 02:56:18 +00:00
Eric Christopher 607fb70750 Make sure that forward declarations are marked as such in the debug info
for the structure type.

rdar://10499337

llvm-svn: 145461
2011-11-29 23:57:40 +00:00
Nick Lewycky 5f2899cbfa The optimizers figured out how to make this store 6.
llvm-svn: 144597
2011-11-15 00:19:16 +00:00
John McCall 16de4d20e0 In ARC, don't reclaim objects of Class type.
llvm-svn: 144561
2011-11-14 19:53:16 +00:00
Pete Cooper 9d6055133b Add invariant.load metadata to loads from selector references. Allows these loads to later be moved/combined in the optimizer. Fixes <rdar://problem/6027699>
llvm-svn: 144318
2011-11-10 21:45:06 +00:00
John McCall f4beacd059 Whenever explicitly activating or deactivating a cleanup, we
need to provide a 'dominating IP' which is guaranteed to
dominate the (de)activation point but which cannot be avoided
along any execution path from the (de)activation point to
the push-point of the cleanup.  Using the entry block is
bad mojo.

llvm-svn: 144276
2011-11-10 10:43:54 +00:00
John McCall e63abb5d2b Fix a subtle bug with cleanups: when activating
a previously-inactive cleanup, not only do we need a
flag variable, but we should also force the cleanup to
query the flag variable.  However, we only need to do
this when we're activating in a context that's
conditionally executed;  otherwise, we may safely
assume that the cleanup is dominated by the activation
point.

llvm-svn: 144271
2011-11-10 09:22:44 +00:00
John McCall 08ef466048 Enter the cleanups for a block outside the enclosing
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
2011-11-10 08:15:53 +00:00
John McCall 3a237aa31c Emit the copy and dipose helpers for ARC __strong
block-typed __block variables using objc_retainBlock
and objc_dispose.  Previously we were using
_Block_object_assign and _Block_object_destroy
with BLOCK_BYREF_CALLER, which causes the runtime
to completely ignore the retain and release.
In most cases this doesn't cause catastrophe
because the retain/release are balanced and
because the block in the variable was copied
upon assignment there.  However, the stack
copy of the variable will be released when
it goes out of scope, which is a problem if
that value was released due to an assignment
to the heap copy.  Similarly, a leak can occur
if the variable is assigned after the copy to
the heap.

llvm-svn: 144162
2011-11-09 03:17:26 +00:00
John McCall d86532ee2c Extract the blocks-related ARC tests into their own file.
llvm-svn: 144158
2011-11-09 02:16:13 +00:00
John McCall 9a54961e01 Bind function "r-values" as l-values when emitting them as
opaque values.  Silly C type system.

llvm-svn: 144144
2011-11-08 22:54:08 +00:00
Anders Carlsson 2f1a6c3f01 In x86_64, when calling an Objective-C method that returns a _Complex long double, make sure to use the objc_msgSend_fp2ret function which ensures that the return value will be {0, 0} if the receiver is nil.
llvm-svn: 143350
2011-10-31 16:27:11 +00:00
Nick Lewycky c64f4a075f Fix test for LLVM change r143186.
llvm-svn: 143187
2011-10-28 05:29:57 +00:00
Fariborz Jahanian cceafc4931 objc: fix an ir-gen crash caused by recent
property refactoring. // rdar://10327068

llvm-svn: 143139
2011-10-27 20:06:32 +00:00
Nick Lewycky b25abd1a54 Move these test from checking assembly to checking LLVM IR. Should fix fallout
from r143097.

llvm-svn: 143098
2011-10-27 07:11:43 +00:00
Fariborz Jahanian b005070b83 Objective-c: fix an ir-gen crash where objc messag returns a _Complex
value and ABI requires return slot to be passed as first
argument to message sent. // rdar://10331109

llvm-svn: 143053
2011-10-26 20:53:59 +00:00
Eric Christopher 7ec8ec8581 Add block information for ObjC @catch blocks.
Fixes rdar://10282889

llvm-svn: 142467
2011-10-19 00:44:01 +00:00
John McCall 444bd25dff Strip qualifiers off the type of an implicit property defined by
only a setter.

llvm-svn: 142236
2011-10-17 20:05:43 +00:00
Eric Christopher fab289a47d When constructing debug information for synthesized variables for the
non-fragile ABI we may not be able to lay out the type and the debugger
would ignore us even if we did put in the offset. Go ahead and just
put any value there and don't look up the offset since it may not exist.

rdar://10210157

llvm-svn: 141261
2011-10-06 00:31:18 +00:00
John McCall ff61303bd0 Mark calls to objc_retainBlock that don't result from casts
to id so that we can still optimize them appropriately.

llvm-svn: 141064
2011-10-04 06:23:45 +00:00
John McCall 9b0a7cea0f Make -fobjc-nonfragile-abi the -cc1 default, since it's the
increasingly prevailing case to the point that new features
like ARC don't even support the fragile ABI anymore.

This required a little bit of reshuffling with exceptions
because a check was assuming that ObjCNonFragileABI was
only being set in ObjC mode, and that's actually a bit
obnoxious to do.

Most, though, it involved a perl script to translate a ton
of test cases.

Mostly no functionality change for driver users, although
there are corner cases with disabling language-specific
exceptions that we should handle more correctly now.

llvm-svn: 140957
2011-10-02 01:16:38 +00:00
John McCall 248512a573 When performing an @throw in ARC, retain + autorelease
the pointer, being sure to do so before running cleanups
associated with that full-expression.  rdar://10042689

llvm-svn: 140945
2011-10-01 10:32:24 +00:00
John McCall a55902bf98 Parse attributes written in an ObjC method parameter type as
attributes on the parameter declaration.

llvm-svn: 140944
2011-10-01 09:56:14 +00:00
John McCall e4fe245716 Allow the results of cf_returns_not_retained function
calls, or calls to audited functions without an explicit
return attribute, to be casted without a bridge cast.
Tie this mechanism in with the existing exceptions to
the cast restrictions.  State those restrictions more
correctly and generalize.

llvm-svn: 140912
2011-10-01 01:01:08 +00:00
Fariborz Jahanian 0c78427d50 objc gc: assigning to an objc object struct member through an ivar
pointer to this struct must go through the none ivar writer barrier.

llvm-svn: 140867
2011-09-30 18:23:36 +00:00
Fariborz Jahanian c367b8f8cc objc-gc: Fix a corner case where clang fails to generate GC
write barrier with captured pointer to object. // rdar://10150823

llvm-svn: 140399
2011-09-23 18:57:30 +00:00
Bill Wendling f0724e8e06 Throw the switch to convert clang to the new exception handling model!
This model uses the 'landingpad' instruction, which is pinned to the top of the
landing pad. (A landing pad is defined as the destination of the unwind branch
of an invoke instruction.) All of the information needed to generate the correct
exception handling metadata during code generation is encoded into the
landingpad instruction.

The new 'resume' instruction takes the place of the llvm.eh.resume intrinsic
call. It's lowered in much the same way as the intrinsic is.

llvm-svn: 140049
2011-09-19 20:31:14 +00:00
Devang Patel 5a54065c4f Tighten check to match an ivar with corresponding property by using ObjCImplementationDecl.
Radar 10139522 - Part 1.

llvm-svn: 140038
2011-09-19 18:54:16 +00:00
John McCall 30e4efd458 Correctly generate IR for casted "builtin" functions, where
the builtin is really just a predefined declaration.  These are
totally valid to cast.

llvm-svn: 139657
2011-09-13 23:05:03 +00:00
Eli Friedman 5be3e6ae9d Turn off the generation of unaligned atomic load/store; I'm going to explicitly error out on such cases in the backend, at least for the moment.
llvm-svn: 139640
2011-09-13 20:48:30 +00:00
John McCall 94312285b7 A strong property of block type has "copy" setter semantics, not "retain".
This is consistent with the behavior of assigning into a __strong l-value,
and it's also necessary for ensuring that the ivar doesn't end up a dangling
reference.  We decided not to change the behavior of "retain" properties, but
just to make them warnings/errors when of block type.

llvm-svn: 139619
2011-09-13 18:49:24 +00:00
John McCall 0bef0badf6 Don't use native atomics on ivars whose size is not a power of two,
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
2011-09-13 07:33:34 +00:00
John McCall 69cdcec11f This test seems pretty low-value.
llvm-svn: 139589
2011-09-13 07:24:27 +00:00
John McCall 0e5c086de4 Always emit bitfield properties using expression behavior, even if they're
atomic.  This is probably something we should warn about.

llvm-svn: 139584
2011-09-13 05:36:29 +00:00
John McCall f4528ae063 Unify the decision of how to emit property getters and setters into a
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
2011-09-13 03:34:09 +00:00
John McCall cd78e805e9 When converting a block pointer to an Objective-C pointer type, extend
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
2011-09-10 01:16:55 +00:00
Douglas Gregor 8b7d403684 Allow C++0x enumerations with a fixed underlying type in
Objective-C. The @encode'ing of such an enumeration type is the same
as its underlying type. <rdar://problem/5276348>.

llvm-svn: 139297
2011-09-08 17:18:35 +00:00
Fariborz Jahanian 6dd3f39dae objc-gc: Adds support for "weak" property attribute under GC.
// rdar://10073896

llvm-svn: 139203
2011-09-06 23:32:40 +00:00
Eric Christopher e480b1ef3d Remove XFAIL/XTARGET since this is passing on the other bots.
llvm-svn: 138182
2011-08-20 01:08:46 +00:00
Eric Christopher b4da65e631 Migrate, update and FileCheckize:
2010-02-01-utf16-with-null.m
	 2010-02-23-DbgInheritance.m
	 2010-03-17-StructRef.m
	 2011-03-08-IVarLookup.m

from llvm/test/FrontendObjC.

llvm-svn: 138180
2011-08-20 01:04:49 +00:00
Eric Christopher 19de6c75fd Migrate, update and FileCheckize:
2008-11-25-Blocks.m
2009-01-26-WriteBarrier-2.m
2009-02-05-VolatileProp.m
2009-08-05-utf16.m

from llvm/test/FrontendObjC.

llvm-svn: 138175
2011-08-20 00:49:25 +00:00
Eric Christopher fde9786b44 Migrate, FileCheckize and update:
2007-04-03-ObjcEH.m
2007-05-02-Strong.m
2007-10-18-ProDescriptor.m
2007-10-23-GC-WriteBarrier.m
2008-10-3-EhValue.m
2008-11-12-Metadata.m
2008-11-24-ConstCFStrings.m

from llvm/test/FrontendObjC.

llvm-svn: 138172
2011-08-20 00:37:56 +00:00
Devang Patel 2de80d601a Add new test.
Remove one outdated test.

llvm-svn: 138144
2011-08-19 23:26:54 +00:00
Fariborz Jahanian 7e47de3156 objc-arc: @property definitions should default to (strong) when not
specified. // rdar://9971982

llvm-svn: 138062
2011-08-19 19:28:44 +00:00
John McCall 91e82dd477 The continue label in an ARC for-in loop should not involve
releasing the collection.

llvm-svn: 136949
2011-08-05 00:14:38 +00:00
Ted Kremenek e5b5dea9f2 This test still hangs on win32, despite XFAIL it. Remove XFAIL.
llvm-svn: 136864
2011-08-04 03:24:35 +00:00
Ted Kremenek 8dbe44aed5 XFAIL arc.m codegen test on win32 because it is currently hanging. Need to investigate.
llvm-svn: 136850
2011-08-04 00:25:52 +00:00
John McCall 9c8e1c9401 Use the general conditional-cleanup framework instead of rolling our
own, incorrectly, for releasing objects at the end of a full-expression.

llvm-svn: 136823
2011-08-03 22:24:24 +00:00
John McCall 32a4da04c2 In ARC, don't try to reclaim the result of a call to performSelector
unless done in a context where the value is used retained.

llvm-svn: 136769
2011-08-03 07:02:44 +00:00
John McCall b726a55729 Fix a couple of problems with initialization and assignment to
__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
2011-07-28 07:23:35 +00:00
John McCall d9bb743e0d The lock operand to an @synchronized statement is also
supposed to be a full-expression;  make it so.  In ARC, make sure
we retain the lock for the entire protected block. 

llvm-svn: 136271
2011-07-27 21:50:02 +00:00
John McCall 538482373b Clean up the analysis of the collection operand to ObjC
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
2011-07-27 01:07:15 +00:00
John McCall cf1667022f Document the existing objc_precise_lifetime attribute.
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
2011-07-22 08:53:00 +00:00
John McCall 24fada127f In ARC, non-atomic getters do not need to retain and autorelease
their loaded values, although it still worth doing this for __weak
properties to get the autoreleased-return-value optimization.

llvm-svn: 135747
2011-07-22 05:23:13 +00:00
John McCall d2930c2100 In Objective-C, pull arbitrary attributes from overridden
methods, including indirectly overridden methods like those
declared in protocols and categories.  There are mismatches
that we would like to diagnose but aren't yet, but this   
is fine for now.

I looked at approaches that avoided doing this lookup 
unless we needed it, but the infer-related-result-type
checks were doing it anyway, so I left it with the same
fast-path check for no previous declartions of that 
selector.

llvm-svn: 135743
2011-07-22 02:45:48 +00:00
Fariborz Jahanian 53a495bd75 Removes a comment.
llvm-svn: 135640
2011-07-20 23:53:57 +00:00
Fariborz Jahanian 517695b27c objc-arc: Fixes a crash @throw'ing an objc message.
// pr10411

llvm-svn: 135638
2011-07-20 23:39:56 +00:00
John McCall dffafded6c Don't crash if defining -dealloc in a category.
llvm-svn: 135054
2011-07-13 18:26:47 +00:00