Commit Graph

834 Commits

Author SHA1 Message Date
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
John McCall 97eab0a271 Okay, that rule about zero-length arrays applies to destroying
them, too.

llvm-svn: 135038
2011-07-13 08:09:46 +00:00
Douglas Gregor 7e6bfb4a0d In ARC mode, consider Objective-C lifetime types (object pointers and
block pointers) that don't have any qualification to be POD types. We
were previously considering them to be non-POD types, because this was
convenient in C++ for is_pod-like traits. However, we now end up
inferring lifetime in such cases (template arguments infer __strong),
so it is not necessary.

Moreover, we want rvalues of object type (which have their lifetime
stripped) to be PODs to allow, e.g., va_arg(arglist, id) to function
properly. Fixes <rdar://problem/9758798>.

llvm-svn: 134993
2011-07-12 17:28:52 +00:00
John McCall 4bd0fb1f09 Switch field destruction over to use the new destroyer-based API
and kill a lot of redundant code.

llvm-svn: 134988
2011-07-12 16:41:08 +00:00
Chris Lattner 117b724b59 keep track of whether being in a RS_StructPointer state
caused us to skip layout out a function accurately.  If
so, flush the type cache for both the function and struct
case to ensure that any pointers to the functions get
recomputed.  This is overconservative, but with this patch
clang can build itself again.

llvm-svn: 134863
2011-07-10 05:39:13 +00:00
Chris Lattner d1f1158203 Fix the clang bootstrap and Jay's testcase from llvm-dev by being completely
conservative when converting a functiontype to IR when in a "pointer within
a struct" context.  This has the unfortunate sideeffect of compiling all 
function pointers inside of structs into "{}*" which, though correct, is
ugly.  This has the positive side effect of being correct, and it is pretty
straight-forward to improve on this.

llvm-svn: 134861
2011-07-10 03:47:27 +00:00
Chris Lattner a5f58b05e8 clang side to match the LLVM IR type system rewrite patch.
llvm-svn: 134831
2011-07-09 17:41:47 +00:00
John McCall 82fe67bb82 A number of array-related IR-gen cleanups.
- 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
2011-07-09 01:37:26 +00:00
John McCall 4db5c3c83a In ARC, reclaim all return values of retainable type, not just those
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
2011-07-07 06:58:02 +00:00
John McCall 9de1978f6e Call objc_terminate() instead of abort() when a cleanup throws an
exception in Objective-C;  in Objective-C++ we still use std::terminate().
This is only available in very recent runtimes.

llvm-svn: 134456
2011-07-06 01:22:26 +00:00
John McCall 24fc0decfe Change the driver's logic about Objective-C runtimes: abstract out a
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
2011-07-06 00:26:06 +00:00
Fariborz Jahanian 326701e2c7 objc-arc: fix a IRGen crash when checking for
accessibility of an initializer which is a compound 
statement. // rdar://9694706

llvm-svn: 134091
2011-06-29 20:00:16 +00:00
John McCall 1c382d71ee Test case for r133840, neglectfully uncommitted.
llvm-svn: 133841
2011-06-24 23:29:50 +00:00
John McCall 23c29fea92 Change the IR-generation of VLAs so that we capture bounds,
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
2011-06-24 21:55:10 +00:00
John McCall 6b0feb7ed6 Emit @finally blocks completely lazily instead of forcing their
existence by always threading an edge from the catchall.  Not doing
this was previously causing a crash in the very extreme case where
neither the normal cleanup nor the EH catchall was actually reachable:
we would delete the catchall entry block, which would cause us to
delete the entry block of the finally cleanup as well because the
cleanup logic would merge the blocks, which in turn triggered an assert
because later blocks in the finally would still be using values from the
entry.  Laziness turns out to be the most elegant solution to the problem.

llvm-svn: 133601
2011-06-22 02:32:12 +00:00
Fariborz Jahanian 9b83be832b objc-arc: Add support for unbridged cast of
__builtin___CFStringMakeConstantString and CF typed function calls 
with explicit cf_returns_retained/cf_returns_not_retained attributes.
// rdar://9544832

llvm-svn: 133535
2011-06-21 19:42:38 +00:00
Fariborz Jahanian 7887637c82 objc-arc: CodeGen part of unbridged cast of CF types.
// rdar://9474349

llvm-svn: 133525
2011-06-21 17:38:29 +00:00
John McCall d463132f27 Objective-C fast enumeration loop variables are not retained in ARC, but
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
2011-06-17 06:42:21 +00:00
Fariborz Jahanian d9bc6c3f59 For the purpose of @encode'ing, accept 'void' type
(even though it is incomplete type) because gcc
says so. // rdar://9622422

llvm-svn: 133208
2011-06-16 22:34:44 +00:00
John McCall 31168b077c Automatic Reference Counting.
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
2011-06-15 23:02:42 +00:00
Devang Patel b4956a7fac Remote this unreliable test case because it did not do its job.
llvm-svn: 132948
2011-06-13 23:14:35 +00:00
Galina Kistanova a6faf8e28b These tests require particular registered targets. Declared as such.
llvm-svn: 132623
2011-06-04 04:38:16 +00:00
Galina Kistanova f56b4f6fdd These tests require particular registered targets. Declared as such.
llvm-svn: 132600
2011-06-03 22:24:54 +00:00
Devang Patel 72140d553a Fix test, check for stable strings in the output.
llvm-svn: 132370
2011-05-31 22:37:03 +00:00
Devang Patel 7ce99c3637 List objective-c ineterfaces as public types in dwarf debug info output.
llvm-svn: 132361
2011-05-31 21:18:50 +00:00
John McCall 9b382dde92 Convert Clang over to resuming from landing pads with llvm.eh.resume.
It's quite likely that this will explode, but I need to know how. :)

llvm-svn: 132269
2011-05-28 21:13:02 +00:00
Eli Friedman 380b8dad6b Back out r132209; it's breaking nightly tests.
llvm-svn: 132219
2011-05-27 21:32:17 +00:00
John McCall 63fb333fa4 Implement a new, much improved version of the cleanup hack. We just need
to be careful to emit landing pads that are always prepared to handle a
cleanup path.  This is correct mostly because of the fix to the LLVM
inliner, r132200.

llvm-svn: 132209
2011-05-27 20:01:14 +00:00
Douglas Gregor a9d8493310 Objective-C doesn't consider the use of incomplete types as method
parameter types to be ill-formed. However, it relies on the
completeness of method parameter types when producing metadata, e.g.,
for a protocol, leading IR generating to crash in such cases.

Since there's no real way to tighten down the semantics of Objective-C
here without breaking existing code, do something safe but lame:
suppress the generation of metadata when this happens.

Fixes <rdar://problem/9123036>.

llvm-svn: 132171
2011-05-27 01:19:52 +00:00
Devang Patel 433a11b95a Test case for r131940.
llvm-svn: 131941
2011-05-24 00:22:40 +00:00
Devang Patel e7ce54074f Fix location of setter/getter synthesized for a property.
llvm-svn: 131701
2011-05-19 23:37:41 +00:00
Fariborz Jahanian 7bd3d1c49b Patch to fix IR-gen crash generating structure ABI which implements
user specified string class via -fconstant-string-class option.
pr9914.

llvm-svn: 131496
2011-05-17 22:21:16 +00:00
Argyrios Kyrtzidis 49b35de2a1 Reapply the commits that r131401 reverted and add a fix for PR9927.
llvm-svn: 131446
2011-05-17 00:46:38 +00:00
Rafael Espindola c0d4cb17c1 Revert 131377, 131369 and 131365.
131365 caused PR9927.

llvm-svn: 131401
2011-05-16 12:30:54 +00:00
Argyrios Kyrtzidis ba6685c390 Fix generation of obj-c @encoding for members with zero size.
Also follow gcc in that arrays of elements with zero size are encoded as arrays with zero elements.

llvm-svn: 131369
2011-05-15 00:11:35 +00:00
John McCall 5880fb8edf Only perform the null-initialization of an aggregate result of a message
send if the receiver is null.  Normally it's not worthwhile to check this,
but avoiding the null-initialization is nice, and this also avoids nasty
problems where the null-initialization is visible within the call because
we use an aliased result buffer.  rdar://problem/9402992

llvm-svn: 131366
2011-05-14 21:12:11 +00:00
Argyrios Kyrtzidis dd72aafffc Create proper Objective-C @encoding for C++ classes; fixes rdar://9357400.
Go through and expand the members of bases into the encoding string (and encode the VTable as well).
Unlike gcc which expands virtual bases as many times as they appear in the
hierarchy, clang will only expand them once at the end, to reflect the actual layout.

Note that there doesn't seem to be a way to indicate in the encoding that
packing/alignment of members is different that normal, in which case
the encoding will be out-of-sync with the real layout.
If the runtime switches to just consider the size of types without
taking into account alignment, we could easily make padding explicit in the
encoding (e.g. using arrays of chars). The encoding strings would be
longer then though.

Also encode a flexible array member as array of 0 size, like gcc, not as a pointer.

llvm-svn: 131365
2011-05-14 20:32:43 +00:00
Devang Patel e91b54cc56 Doug convinced me that DW_AT_APPLE_objc_complete_type is more appropriate name.
s/DW_AT_APPLE_objc_class_extension/DW_AT_APPLE_objc_complete_type/g

llvm-svn: 131245
2011-05-12 21:29:57 +00:00
Devang Patel 70d77d144b Do not add AT_APPLE_objc_class_extension attribute if @implementation is not seen.
llvm-svn: 131242
2011-05-12 21:14:54 +00:00
Devang Patel 36882c8f24 Use DW_AT_APPLE_objc_class_extension attribute to identify interfaces that represent class extension.
Radar 9423077.

llvm-svn: 131239
2011-05-12 19:07:41 +00:00
Bill Wendling f7d4598b74 Pack ivar offsets together.
Ivar offsets for synthesized ivars are wrong, which could end up with a large
number of dirty pages because of ivar fixups at runtime. When we pack all of the
synthesized ivars into the same section, it limits the number of dirty pages
created. Place them in the "__DATA,__objc_ivar" section.
<rdar://problem/9374905>

llvm-svn: 130870
2011-05-04 21:37:25 +00:00
Devang Patel f32f098fd2 Silence warnings.
llvm-svn: 130785
2011-05-03 20:22:16 +00:00
Devang Patel 2a7c219466 Emit debug info for __destroy_helper_block_ and __copy_helper_block.
llvm-svn: 130719
2011-05-02 20:37:08 +00:00
Rafael Espindola 9af3d4b193 Add r130624 back now that ELF has been fixed to work with -fno-dwarf2-cfi-asm.
llvm-svn: 130659
2011-05-01 15:45:27 +00:00
Rafael Espindola 37981e6099 Revert the previous patch while I figure out how to make llvm-gcc
less agressive about disabling cfi on linux :-(

llvm-svn: 130627
2011-04-30 23:07:10 +00:00
Rafael Espindola 1f6936b6c7 Update for cfi.
llvm-svn: 130624
2011-04-30 22:30:24 +00:00
Rafael Espindola 6a10ed51c0 Pass -fno-dwarf2-cfi-asm and use FileCheck.
llvm-svn: 130617
2011-04-30 18:47:32 +00:00
Daniel Dunbar c76da44eeb tests: Tweak test to not write to the same temporary twice, in the hopes of avoiding sporadic win32 failures about renaming a temporary.
llvm-svn: 130439
2011-04-28 21:23:38 +00:00
Daniel Dunbar a59b0a6e3c IRgen/Darwin: Fix refacto introduced in Triple changes.
llvm-svn: 130233
2011-04-26 19:43:00 +00:00
Fariborz Jahanian c057794adb Fixes an instance method meta-data generation bug in
ObjC NeXt runtime where method pointer registered in
metadata belongs to an unrelated method. Ast part of this fix,
I turned at @end missing warning (for class
implementations) into an error as we can never
be sure that meta-data being generated is correct.
// rdar://9072317

llvm-svn: 130019
2011-04-22 22:02:28 +00:00
Devang Patel 9d6c857862 Emit debug info for Objective-C properties.
llvm-svn: 129625
2011-04-16 00:12:55 +00:00
Daniel Dunbar 9c8cd4c097 IRgen/Obj-C: Emit CFStrings and NSStrings with the alignment of the char type,
there is no reason to align them higher.
 - This roughly matches llvm-gcc's r126913.
 - It is an open question whether or not we should do this for cstring's in
   general (code size vs optimization potential), for now we just match llvm-gcc
   until someone wants to run some experiments.

llvm-svn: 129410
2011-04-12 23:30:52 +00:00
John McCall 58989b7125 We can't emit an aggregate cast as its sub-expression in general just
because the result is ignored.  The particular example here is with
property l-values, but there could be all sorts of lovely casts that this
isn't safe for.  Sink the check into the one case that seems to actually
be capable of honoring this.

llvm-svn: 129397
2011-04-12 22:02:02 +00:00
Fariborz Jahanian 5de5313abe Refine rules for atomic property api to
pass a previously failing clang test.
// rdar://8808439

llvm-svn: 129004
2011-04-06 16:05:26 +00:00
Fariborz Jahanian 10a95ca876 Fixes a regression caused by my last patch.
As a result, I had to remove a c++ version of a clang
test which requires more scrutiny on my part.

llvm-svn: 128950
2011-04-05 23:01:27 +00:00
Fariborz Jahanian 0f4c711895 Generate atomic api for atomic properties (x86 and x86_64
targets) when load/store results in multiple instructions.
// rdar://8808439

llvm-svn: 128937
2011-04-05 21:41:23 +00:00
Devang Patel 6f2e41e0d4 Do not line number entry for unconditional branches. Usually, users do not want to stop at closing '}'.
llvm-svn: 128471
2011-03-29 18:35:54 +00:00
Douglas Gregor 1baf38f5a6 On Mac OS X, the presence of an 'availability' attribute for that
platform implies default visibility. To achieve these, refactor our
lookup of explicit visibility so that we search for both an explicit
VisibilityAttr and an appropriate AvailabilityAttr, favoring the
VisibilityAttr if it is present.

llvm-svn: 128336
2011-03-26 12:10:19 +00:00
Daniel Dunbar 7c9295a5b4 Obj-C/NeXT: Update and reapply 108847, now that changes are more baked.
llvm-svn: 128300
2011-03-25 20:09:09 +00:00
David Chisnall 76803410c2 Fixed type error in last commit (forgot that now that selectors are not
accessed via the indirect pointer, they don't need to be pointers to pointers).

Finished moving the message lookup code into separate subclasses for each
runtime.  Also performed a few smallish related tidies.

We're now bitcasting the result of the message lookup functions, rather than
casting the lookup functions themselves, so the messages.m test needed updating
to reflect this.

llvm-svn: 128180
2011-03-23 22:52:06 +00:00
Douglas Gregor 20b2ebd785 Implement a new 'availability' attribute, that allows one to specify
which versions of an OS provide a certain facility. For example,

  void foo()
  __attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6)));

says that the function "foo" was introduced in 10.2, deprecated in
10.4, and completely obsoleted in 10.6. This attribute ties in with
the deployment targets (e.g., -mmacosx-version-min=10.1 specifies that
we want to deploy back to Mac OS X 10.1). There are several concrete
behaviors that this attribute enables, as illustrated with the
function foo() above:

  - If we choose a deployment target >= Mac OS X 10.4, uses of "foo"
    will result in a deprecation warning, as if we had placed
    attribute((deprecated)) on it (but with a better diagnostic)
  - If we choose a deployment target >= Mac OS X 10.6, uses of "foo"
    will result in an "unavailable" warning (in C)/error (in C++), as
    if we had placed attribute((unavailable)) on it
  - If we choose a deployment target prior to 10.2, foo() is
    weak-imported (if it is a kind of entity that can be weak
    imported), as if we had placed the weak_import attribute on it.

Naturally, there can be multiple availability attributes on a
declaration, for different platforms; only the current platform
matters when checking availability attributes.

The only platforms this attribute currently works for are "ios" and
"macosx", since we already have -mxxxx-version-min flags for them and we
have experience there with macro tricks translating down to the
deprecated/unavailable/weak_import attributes. The end goal is to open
this up to other platforms, and even extension to other "platforms"
that are really libraries (say, through a #pragma clang
define_system), but that hasn't yet been designed and we may want to
shake out more issues with this narrower problem first.

Addresses <rdar://problem/6690412>.

As a drive-by bug-fix, if an entity is both deprecated and
unavailable, we only emit the "unavailable" diagnostic.

llvm-svn: 128127
2011-03-23 00:50:03 +00:00
John McCall e99e5dcbd3 Don't emit read barriers for reading __weak __block variables
in non-GC mode.

llvm-svn: 127725
2011-03-16 02:53:38 +00:00
Fariborz Jahanian cf7f66f16f objc IRGen for Next runtime message API.
The prototype for objc_msgSend() is technically variadic - 
`id objc_msgSend(id, SEL, ...)`. 
But all method calls should use a prototype that matches the method, 
not the prototype for objc_msgSend itself().
// rdar://9048030

llvm-svn: 126754
2011-03-01 17:28:13 +00:00
Fariborz Jahanian 557c1ed522 Revert r126678.
llvm-svn: 126685
2011-02-28 21:19:34 +00:00
Fariborz Jahanian 79246322a6 objc IRGen for Next runtime message API.
The prototype for objc_msgSend() is technically variadic - 
`id objc_msgSend(id, SEL, ...)`. 
But all method calls should use a prototype that matches the method, 
not the prototype for objc_msgSend itself().
// rdar://9048030

llvm-svn: 126678
2011-02-28 19:55:59 +00:00
John McCall 71309be80a Zero-initialize the struct-return slot of an Objective-C message
send before making the call.  Fixes rdar://problem/7854674

llvm-svn: 126543
2011-02-26 09:12:15 +00:00
John McCall 9e2e22f5c6 Establish the iteration variable of an ObjC for-in loop before
emitting the collection expression.  Fixes some really, really broken
code.

llvm-svn: 126193
2011-02-22 07:16:58 +00:00
John McCall c533cb7008 Reorganize the emission of local variables.
llvm-svn: 126189
2011-02-22 06:44:22 +00:00
Anders Carlsson 3320e1575f Make clang -cc1 disable Objective-C exceptions by default, and add a -fobjc-exceptions flag to turn them on.
Update all tests accordingly.

llvm-svn: 126177
2011-02-22 01:52:06 +00:00
Anders Carlsson 4fc229ef69 Move some Objective-C tests to SemaObjC and CodeGenObjC.
llvm-svn: 126175
2011-02-22 01:23:29 +00:00
Fariborz Jahanian 302a3d4e4d Objective-c armv7 API for atomic properties of
scalar types. // rdar://7761305

llvm-svn: 125946
2011-02-18 19:15:13 +00:00
John McCall a9a2e8a58d The flags we're supposed to write into a byref struct are *not* the
_Block_object_* flags;  it's just BLOCK_HAS_COPY_DISPOSE or not.

Also, we don't need to chase forwarding pointers prior to calling
_Block_object_dispose;  _Block_object_dispose in fact already does
this.

rdar://problem/9006315

llvm-svn: 125823
2011-02-18 02:58:31 +00:00
Chris Lattner ffda452fbf update this test now that reassociate isn't stripping nsw's pointlessly.
llvm-svn: 125705
2011-02-17 02:02:42 +00:00
John McCall bf9a86b50f Don't call objc_read_weak as part of emitting a block literal.
Nobody ever gave me a clear reason for why we were doing this, and
now it's apparently causing serious problems, so if *not* having this
causes problems, we get to solve them the right way this time.

llvm-svn: 125627
2011-02-16 00:49:34 +00:00
Devang Patel 17ac005dbb Add target triple.
llvm-svn: 125230
2011-02-09 22:29:15 +00:00
Devang Patel 84d40a431f Do not emit AT_MIPS_linkage_name for Objective-C method static variable i.
llvm-svn: 125210
2011-02-09 19:16:38 +00:00
Devang Patel 19ba2b4d6e Emit debug info for objc_selector.
llvm-svn: 125163
2011-02-09 03:15:05 +00:00
Fariborz Jahanian 701f094afb Fix an IRGen bug in property setter calls when
setter and getter types mismatch. // rdar://8966864

llvm-svn: 125125
2011-02-08 22:33:23 +00:00
John McCall 351762cda2 A few more tweaks to the blocks AST representation:
- BlockDeclRefExprs always store VarDecls
  - BDREs no longer store copy expressions
  - BlockDecls now store a list of captured variables, information about
    how they're captured, and a copy expression if necessary
    
With that in hand, change IR generation to use the captures data in       
blocks instead of walking the block independently.        

Additionally, optimize block layout by emitting fields in descending
alignment order, with a heuristic for filling in words when alignment
of the end of the block header is insufficient for the most aligned
field.

llvm-svn: 125005
2011-02-07 10:33:21 +00:00
Dan Gohman b93f581948 Update this test following recent optimizer changes.
llvm-svn: 124715
2011-02-02 02:21:10 +00:00
John McCall f26870c43d Not really any point to testing control flow in this test without
ret duplication.

llvm-svn: 124476
2011-01-28 06:05:16 +00:00
Eric Christopher 709e1f3711 Update exceptions.m for r124462.
llvm-svn: 124474
2011-01-28 05:13:18 +00:00
Fariborz Jahanian 2f2fa7284b Fixes an IRgen bug where __block variable is
referenced in the block-literal initializer
of that variable. // rdar://8893785

llvm-svn: 124332
2011-01-26 23:08:27 +00:00
Devang Patel d2d6665c71 Emit DW_TAG_lexical_scope to surround foreach.
llvm-svn: 123802
2011-01-19 01:36:36 +00:00
Rafael Espindola d661a853fd Add unnamed_addr in CreateRuntimeVariable.
llvm-svn: 123773
2011-01-18 21:07:57 +00:00
Rafael Espindola de089d462c merge strings created by
const NSConstantString *appKey =  @"MyApp";

llvm-svn: 123680
2011-01-17 22:11:21 +00:00
Rafael Espindola b7f60e3474 Add unnamed_addr when creating artificial string globals. For example, in
static const char foo[] = "foo";
static const char *bar = "bar";

the global created to hold "bar" will have it, but foo will not.

llvm-svn: 123192
2011-01-10 22:34:03 +00:00
Fariborz Jahanian 3aa19e9a70 Fold -fobjc-nonfragile-abi2 into -fobjc-nonfragile-abi.
// rdar://8818375

llvm-svn: 122831
2011-01-04 20:05:20 +00:00
Fariborz Jahanian 9a7d57d57f Consider zero-length array of structs when
computing ivar layouts for objc-gc.
Fixes // rdar://8800513

llvm-svn: 122762
2011-01-03 19:23:18 +00:00
David Chisnall 6f0a7d224b Fix for PR8695.
llvm-svn: 122564
2010-12-26 20:12:30 +00:00
Ted Kremenek 1d56c9eed7 Add -fobjc-default-synthesized-properties flag
to allow us to explicitly control whether or
not Objective-C properties are default synthesized.
Currently this feature only works when using
the -fobjc-non-fragile-abi2 flag (so there is
no functionality change), but we can now turn
off this feature without turning off all the features
coupled with -fobjc-non-fragile-abi2.

llvm-svn: 122519
2010-12-23 21:35:43 +00:00
Fariborz Jahanian 522eb7b894 ivars craeted for explicit @synthesize and those
created for auto-synthesis are @private.
Fixes: // rdar://8769582

llvm-svn: 121913
2010-12-15 23:29:04 +00:00
John McCall 9bc2677b8c Do unary conversions on vararg arguments and *then* special-case float.
Fixes PR8742.

llvm-svn: 121022
2010-12-06 18:36:11 +00:00
John McCall 211e699754 Don't crash when initializing a subaggregate in C from a property r-value.
llvm-svn: 120899
2010-12-04 09:03:57 +00:00
John McCall 0692a32a3e Test case for the l-value base only being evaluated once.
Also, move the l-value emission code into CGObjC.cpp and teach it, for
completeness, to store away self for a super send.

Also, inline the super cases for property gets and sets and make them
use the correct result type for implicit getter/setter calls.

llvm-svn: 120887
2010-12-04 03:11:00 +00:00
Fariborz Jahanian 50198098b9 IR Gen. part of API support for __block cxx
objects imported into blocks. //rdar://8594790.
Will have a test case coming (as well as one
sent to llvm test suite).

llvm-svn: 120713
2010-12-02 17:02:11 +00:00
Fariborz Jahanian 2a5deb56a4 Adding couple of Block API, a bug fix and
a test change, all for blocks. wip.

llvm-svn: 118745
2010-11-11 00:11:38 +00:00
Devang Patel 82abab0812 test case for r118726.
llvm-svn: 118727
2010-11-10 22:19:57 +00:00
Fariborz Jahanian d11da7e52a Restore patch reversed in r118475. Fixes
// rdar://8632525

llvm-svn: 118634
2010-11-09 21:38:20 +00:00
Fariborz Jahanian 3655e59688 Reverse patch for // rdar://8632525. It might
has broken a build.

llvm-svn: 118475
2010-11-09 02:24:08 +00:00
Fariborz Jahanian 94ad274c24 Provide a precise builtin declaration for objc_msgSend
to avoid a bogus warning. Fixes //rdar: //8632525

llvm-svn: 118451
2010-11-08 22:53:18 +00:00
Devang Patel f79199d140 Tidy up MIPS_linkage name. Provide it only if it does not match regular name, otherwise it confuses debugger.
This is tested by local.C in llvmgcc testsuite.

llvm-svn: 117107
2010-10-22 17:11:50 +00:00
Fariborz Jahanian 50c925fe96 This patch implements Next's IRGen for -fconstant-string-class=class-name.
PR6056, //rdar: //8564463

llvm-svn: 116819
2010-10-19 17:19:29 +00:00
Fariborz Jahanian f34011e4ca patch fixes class names missing from method names in debug information for
synthesized property. // rdar: //8498026

llvm-svn: 116717
2010-10-18 17:51:06 +00:00
John McCall d509182336 Coding by inspection has its problems.
llvm-svn: 116672
2010-10-16 16:34:08 +00:00
John McCall 17afe45a87 objc_exception_rethrow does not take an exception argument.
rdar://problem/8535238

llvm-svn: 116663
2010-10-16 08:21:07 +00:00
Daniel Dunbar 622581b73b Revert r116656, "IRgen/Obj-C/NeXT: Fix the IR signature for
objc_exception_rethrow, so we don't...", since something is actually trying to
call this with the wrong signature (!). Unfortunately I don't understand the new
EH infrastructure well enough to fix it immediately.

llvm-svn: 116660
2010-10-16 05:04:10 +00:00
Daniel Dunbar 90bb5c2315 IRgen/Obj-C/NeXT: Fix the IR signature for objc_exception_rethrow, so we don't
generate unnecessary %al clear on x86_64.

llvm-svn: 116656
2010-10-16 04:08:16 +00:00
Douglas Gregor f10c97f36e _Bool is not a keyword in C++. Fixes PR7388 and PR8349.
llvm-svn: 116422
2010-10-13 20:00:38 +00:00
Fariborz Jahanian d06ab4f09e Test for //rdar: //8493239
llvm-svn: 116258
2010-10-11 23:15:47 +00:00
Daniel Dunbar 7cba5a76dd IRgen/Obj-C: Fix encoding of "long double".
- The mind boggles.

llvm-svn: 116226
2010-10-11 21:13:48 +00:00
Daniel Dunbar a441d81b6b Merge encode-test-1.m into encode-test.m
llvm-svn: 116225
2010-10-11 21:13:46 +00:00
Daniel Dunbar 32708f952b FileCheck'ize test.
llvm-svn: 116224
2010-10-11 21:13:44 +00:00
Daniel Dunbar 355e850c6c tests: Tweak test to also match MSVC format.
llvm-svn: 115969
2010-10-07 20:14:30 +00:00
John McCall 569eafce63 Re-enable EH cleanups to destroy __block variables, now that we have a moment to
deal with the consequences.  Fixes rdar://problem/8224178.

llvm-svn: 115816
2010-10-06 18:56:43 +00:00
John McCall 9916e3fa93 In the fragile ObjC ABI, save the caught exception to the side if there are
both @catches and a @finally, because the second call to @objc_exception_try_enter
will clobber the exception slot.  Fixes rdar://problem/8440970.

llvm-svn: 115575
2010-10-04 23:42:51 +00:00
Fariborz Jahanian de744dcce1 Restore test. Is for //rdar://8493239
llvm-svn: 115349
2010-10-01 21:26:26 +00:00
Fariborz Jahanian 220d971ace Remove test until further notice.
llvm-svn: 115258
2010-10-01 01:01:03 +00:00
Fariborz Jahanian ef1fb2d1d1 Fix test.
llvm-svn: 115253
2010-10-01 00:27:17 +00:00
Fariborz Jahanian 885e9dff93 Output debug info. for ivars declared in class
extension and implementation.
Fixes rdar://8493239.

llvm-svn: 115248
2010-10-01 00:01:53 +00:00
Devang Patel 7c086227e6 Attach aritifical attribute with implicit parameters.
Radar 8493141.

llvm-svn: 115104
2010-09-29 23:09:21 +00:00
Chris Lattner 775e635b5a update a bunch of tests that are using the x86 backend instead of grepping IR :(
llvm-svn: 114535
2010-09-22 06:09:31 +00:00
Fariborz Jahanian 0aa35b9cf5 Block description for trivial block literals have
their 'isa' field scanned regardless.

llvm-svn: 113749
2010-09-13 16:09:44 +00:00
Fariborz Jahanian 933c6723a4 Fixes an obscure bug in importd block variable layout
information when imported variable is used
more than once. Originally though to be a bug in importing
block varibles. Fixes radar 8417746.

llvm-svn: 113675
2010-09-11 01:27:29 +00:00
Fariborz Jahanian cfddabf5a3 Block ivar layout must assume that the 'isa'
field of the block descriptor is GC'able (scanned)
as this what the runtime expects (one can send it 
messages). Radar 8394947.

llvm-svn: 113454
2010-09-09 00:21:45 +00:00
Fariborz Jahanian 366a94822b Local static block variable referecned in its
block-literal initializer expression causes IRgen to crash.
This patch fixes by saving it in StaticLocalDecl map
already used for such purposes. (radar 8390455).

llvm-svn: 113307
2010-09-07 23:26:17 +00:00
Argyrios Kyrtzidis 2fdb5b5955 LastFieldBitfield in CGObjCCommonMac::BuildAggrIvarLayout keeps bitfields or unnamed fields but later the code
assumes that it's always a bitfield. This can lead to a crash (reported at rdar://8368320).

llvm-svn: 113154
2010-09-06 12:00:10 +00:00
Fariborz Jahanian 60babfb8a1 Casting of a property reference to 'void' did not
generate the necessary code. This patch fixes it.
// rdar://8389655

llvm-svn: 113079
2010-09-04 19:49:18 +00:00
Daniel Dunbar 09c8fbe812 tests: Fix a dependency on the temporary value names.
llvm-svn: 112917
2010-09-03 00:24:06 +00:00
Daniel Dunbar a70fab8dd7 IRgen/Obj-C: Rewrite Objective-C bit-field access to compute the access strategy
using the same methods as used for normal structures.
 - This fixes problems with reading past the end of the structure and with
   handling straddled bit-field access.

llvm-svn: 112914
2010-09-02 23:53:31 +00:00
Chris Lattner 369721a16e stop looking for #uses comments.
llvm-svn: 112898
2010-09-02 22:48:26 +00:00
Devang Patel 9cd85d1c77 Robustify test.
llvm-svn: 112062
2010-08-25 17:32:22 +00:00
Daniel Dunbar 5eb22ab7d8 tests: Disable this test for now, it is overly pessimistic and I am not sure how to fix it.
llvm-svn: 112023
2010-08-25 03:40:27 +00:00
Fariborz Jahanian bf9294fb65 Support for IRGen of synthesize bitfield ivars in
objc-nonfragile-abi2 (radar 7824380).

llvm-svn: 111823
2010-08-23 18:51:39 +00:00
Fariborz Jahanian 68e69ca9f9 Patch to issue warning when colllection expresion's type
does not implement 'countByEnumeratingWithState' API.
Implements radar 7634669.

llvm-svn: 110964
2010-08-12 22:25:42 +00:00
John McCall ffe4630f3d When re-raising an exception after a cleanup, we need to call _Unwind_Resume_or_Rethrow
instead of _Unwind_Resume.  With SJLJ exceptions, this is spelled
"_Unwind_SjLj_Resume_or_Rethrow", not "_Unwind_SjLj_Resume", which has
significantly different semantics.

We should actually never be generating a call to _Unwind_SjLj_Resume directly;
even if we were generating true cleanups (which we aren't because of the
horrible hack), we should be calling __cxa_end_cleanup() on ARM.  I
haven't implemented this because there's little point as long as the HH is
present.

I believe this fixes <rdar://problem/8281377>.

llvm-svn: 110851
2010-08-11 20:59:53 +00:00
Fariborz Jahanian d539d098a4 IRGen support for functions returning objc object
types. Fixes PR7865.

llvm-svn: 110832
2010-08-11 17:37:35 +00:00
John McCall ca7993f572 Make this test a little less dependent on exact optimizer results.
llvm-svn: 110770
2010-08-11 02:06:44 +00:00
John McCall cebe0ca75e Fix a bug in @finally emission in both the fragile and non-fragile EH schemes
where we weren't accounting for the possibility that a @finally block might
have internal cleanups and therefore might write to the cleanup destination slot.

Fixes <rdar://problem/8293901>.

llvm-svn: 110760
2010-08-11 00:16:14 +00:00
Fariborz Jahanian f95e358004 Finishing up block variable layout API by supporting
union type variables and their nesting inside other
aggregate types.

llvm-svn: 110448
2010-08-06 16:28:55 +00:00
Fariborz Jahanian 903aba39ee Add support for block imported struct variable layout info.
(objc gc and blocks in NeXt runtime).

llvm-svn: 110377
2010-08-05 21:00:25 +00:00
Fariborz Jahanian 9659f6b540 Block variable layout bitmap API generation.
llvm-svn: 110287
2010-08-04 23:55:24 +00:00
John McCall 2dd7d44135 Some more correctness fixes and code-size optimizations for fragile-ABI
ObjC exceptions:
  - don't enter a try for the catch blocks unless there's a finally
  - put the setjmp buffer in the locals set for liveness reasons
  - dump the sync object into an alloca in the locals set for liveness reasons
Some of this can go away if the backend starts to properly calculate liveness
in the presence of setjmp (which would also be a *much* stabler solution).

llvm-svn: 110188
2010-08-04 05:59:32 +00:00
John McCall 42227edc79 Fix fragile-ABI ObjC exceptions in the presence of optimization with
the magic of inline assembly.  Essentially we use read and write hazards
on the set of local variables to force flushing locals to memory
immediately before any protected calls and to inhibit optimizing locals
across the setjmp->catch edge.  Fixes rdar://problem/8160285

llvm-svn: 109960
2010-07-31 23:20:56 +00:00
Daniel Dunbar cda4307308 Revert "Re-apply fixed version of 108749, correctly conditionalizing the new
sections on", this change uncovered a possible linker bug which resulted in the
wrong messages getting dispatched. Backing this out while we investigate...

llvm-svn: 109817
2010-07-29 22:57:21 +00:00
Chris Lattner 3a44c7e55d now that we have CGT around, we can start using preferred types
for return values too.  Instead of compiling something like:

struct foo {
  int *X;
  float *Y;
};

struct foo test(struct foo *P) { return *P; }

to:

%1 = type { i64, i64 }

define %1 @test(%struct.foo* %P) nounwind {
entry:
  %retval = alloca %struct.foo, align 8           ; <%struct.foo*> [#uses=2]
  %P.addr = alloca %struct.foo*, align 8          ; <%struct.foo**> [#uses=2]
  store %struct.foo* %P, %struct.foo** %P.addr
  %tmp = load %struct.foo** %P.addr               ; <%struct.foo*> [#uses=1]
  %tmp1 = bitcast %struct.foo* %retval to i8*     ; <i8*> [#uses=1]
  %tmp2 = bitcast %struct.foo* %tmp to i8*        ; <i8*> [#uses=1]
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 16, i32 8, i1 false)
  %0 = bitcast %struct.foo* %retval to %1*        ; <%1*> [#uses=1]
  %1 = load %1* %0, align 1                       ; <%1> [#uses=1]
  ret %1 %1
}

We now get the result more type safe, with:

define %struct.foo @test(%struct.foo* %P) nounwind {
entry:
  %retval = alloca %struct.foo, align 8           ; <%struct.foo*> [#uses=2]
  %P.addr = alloca %struct.foo*, align 8          ; <%struct.foo**> [#uses=2]
  store %struct.foo* %P, %struct.foo** %P.addr
  %tmp = load %struct.foo** %P.addr               ; <%struct.foo*> [#uses=1]
  %tmp1 = bitcast %struct.foo* %retval to i8*     ; <i8*> [#uses=1]
  %tmp2 = bitcast %struct.foo* %tmp to i8*        ; <i8*> [#uses=1]
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 16, i32 8, i1 false)
  %0 = load %struct.foo* %retval                  ; <%struct.foo> [#uses=1]
  ret %struct.foo %0
}

That memcpy is completely terrible, but I don't know how to fix it.

llvm-svn: 109729
2010-07-29 04:46:19 +00:00
Fariborz Jahanian 72cdffa401 Return type of a setter call caused by
use of property-dot syntax using 'super' as receiver
is 'void'. This fixes a bug in generating correct
API for setter call. Fixes radar 8203426.

llvm-svn: 109297
2010-07-24 00:34:08 +00:00
John McCall ad5d61e227 Revise cleanup IR generation to fix a major bug with cleanups (PR7686)
as well as some significant asymptotic inefficiencies with threading
multiple jumps through deep cleanups.

llvm-svn: 109274
2010-07-23 21:56:41 +00:00
Jim Grosbach 71d963e954 Re-apply fixed version of 108749, correctly conditionalizing the new sections on
ObjC ABI version 2 this time.

llvm-svn: 108847
2010-07-20 16:20:26 +00:00
Jim Grosbach 428a7103d9 and revert the related tests, too
llvm-svn: 108766
2010-07-19 22:53:57 +00:00
Jim Grosbach 6331d9781c Update tests for r108749
llvm-svn: 108754
2010-07-19 21:39:14 +00:00
Daniel Dunbar 2c91be4261 IRgen: Add a test case I forgot to commit at some point.
llvm-svn: 108713
2010-07-19 17:11:38 +00:00
John McCall 36ea3723c0 The GNU-runtime ObjC personality function doesn't let us rethrow with URR for
multiple reasons.  Rethrow with _objc_exception_throw instead.  Fixes PR7656.

llvm-svn: 108595
2010-07-17 00:43:08 +00:00
John McCall 2b7fc3828e Teach IR generation how to lazily emit cleanups. This has a lot of advantages,
mostly in avoiding unnecessary work at compile time but also in producing more
sensible block orderings.

Move the destructor cleanups for local variables over to use lazy cleanups.
Eventually all cleanups will do this;  for now we have some awkward code
duplication.

Tell IR generation just to never produce landing pads in -fno-exceptions.
This is a much more comprehensive solution to a problem which previously was
half-solved by checks in most cleanup-generation spots.

llvm-svn: 108270
2010-07-13 20:32:21 +00:00
John McCall bd30929e4d Validated by nightly-test runs on x86 and x86-64 darwin, including after
self-host.  Hopefully these results hold up on different platforms.  

I tried to keep the GNU ObjC runtime happy, but it's hard for me to test.
Reimplement how clang generates IR for exceptions.  Instead of creating new
invoke destinations which sequentially chain to the previous destination,
push a more semantic representation of *why* we need the cleanup/catch/filter
behavior, then collect that information into a single landing pad upon request.

Also reorganizes how normal cleanups (i.e. cleanups triggered by non-exceptional
control flow) are generated, since it's actually fairly closely tied in with
the former.  Remove the need to track which cleanup scope a block is associated
with.

Document a lot of previously poorly-understood (by me, at least) behavior.

The new framework implements the Horrible Hack (tm), which requires every
landing pad to have a catch-all so that inlining will work.  Clang no longer
requires the Horrible Hack just to make exceptions flow correctly within
a function, however.  The HH is an unfortunate requirement of LLVM's EH IR.

llvm-svn: 107631
2010-07-06 01:34:17 +00:00
Daniel Dunbar 8c94ffe776 IRgen: Assignment to Objective-C properties shouldn't reload the value, for
complex values either. Previously we did this properly for regular assignment,
but not for compound assignment.
 - Also, tidy up assignment code a bit to look more like the scalar path.

llvm-svn: 107217
2010-06-29 22:44:21 +00:00
Daniel Dunbar c85ea8e175 IRgen: Assignment to Objective-C properties shouldn't reload the value (which
would trigger an extra method call).
 - While in the area, I also changed Clang to not emit an unnecessary load from
   'x' in cases like 'y = (x = 1)'.

llvm-svn: 107210
2010-06-29 22:00:45 +00:00
Fariborz Jahanian a9f90275cc Trying to make BuildBot happy again (related to PR7431).
llvm-svn: 106553
2010-06-22 17:08:32 +00:00
Fariborz Jahanian 7966aff294 Fixes a problem in generation of meta-data for
category implementation whereby property list was missing.
NeXt ObjC runtime (radar 8093297).

llvm-svn: 106550
2010-06-22 16:33:55 +00:00
Douglas Gregor de049cdbe6 Attempt to fix test
llvm-svn: 106522
2010-06-22 02:17:07 +00:00
Fariborz Jahanian 2990e3a502 Test case for PR7431 by Nico Weber.
llvm-svn: 106494
2010-06-21 22:21:57 +00:00
Rafael Espindola b35e7b8659 Fix tests that I missed from my previous commit.
llvm-svn: 106118
2010-06-16 17:49:52 +00:00
Fariborz Jahanian be21aa34a0 When using property-dot assignment syntax to call a setter method,
type of rhs need be compared to setter's argument and
not the getter type. Fixes radar 8062778

llvm-svn: 105560
2010-06-07 22:02:01 +00:00
Fariborz Jahanian a2d7c34e93 Fixed a block regression caused by trying to use
an existing ir for load of a bock variable. This cannot be
done across basic blocks.
Fixes radar 8064140.

llvm-svn: 105549
2010-06-07 19:39:39 +00:00
David Chisnall b190a2c74a Fixed Objective-C type encoding for bitfields for the GNU runtime to match the encoding used by GCC.
llvm-svn: 105451
2010-06-04 01:10:52 +00:00
Douglas Gregor aab11ede6e Fix testsuite for blocks mangling change
llvm-svn: 104618
2010-05-25 17:46:21 +00:00
Fariborz Jahanian 6dc47ed396 Changed test to use FileCheck.
llvm-svn: 104319
2010-05-21 16:13:37 +00:00
John McCall 9d42f0f174 Allocate space in a block record for implicit references to the Objective C
'self' variable arising from uses of the 'super' keyword.  Also reorganize
some code so that BlockInfo (now CGBlockInfo) can be opaque outside of
CGBlocks.cpp.

Fixes rdar://problem/8010633.

llvm-svn: 104312
2010-05-21 04:11:14 +00:00
Fariborz Jahanian 2792f30f13 Generate objc_memmove_collectable write-barrier for
classes whose base class have GC'able object pointers.

llvm-svn: 104296
2010-05-20 23:34:56 +00:00
Fariborz Jahanian 60d215b6fd Adds support for generation of objc_memmove_collectable API
in Objective-C++ mode.

llvm-svn: 104281
2010-05-20 21:38:57 +00:00
Fariborz Jahanian c21ba96566 More Objective-C++ GC tests.
llvm-svn: 104253
2010-05-20 18:22:28 +00:00
Fariborz Jahanian e150539100 More tests for ObjC++ GC support.
llvm-svn: 104176
2010-05-19 23:07:54 +00:00
John McCall 3e294929b8 Correctly generate IR for ObjC messages sends to protocol-qualified types.
Fixes rdar://problem/7992749

llvm-svn: 103965
2010-05-17 20:12:43 +00:00
Fariborz Jahanian bdb1b0d6cb Implement new default property synthesis rules. Essentially, no longer
user directive is needed to force a property implementation.
It is decided based on those propeties which are declared in
the class (or in its protocols) but not those which must be
default implemented by one of its super classes. Implements radar 7923851.

llvm-svn: 103787
2010-05-14 18:35:57 +00:00
Fariborz Jahanian f7ba3208a3 Fix test.
llvm-svn: 103487
2010-05-11 18:48:13 +00:00
Daniel Dunbar 341db487a8 tests: Avoid spurious use of /dev/null.
llvm-svn: 103446
2010-05-10 23:31:31 +00:00
Devang Patel b319adec49 If variable location is invalid then use current location.
This fixes radar 7959934.

llvm-svn: 103408
2010-05-10 17:24:58 +00:00
Fariborz Jahanian 6147a7b9b8 Test case for NeXt's -fno-constant-cfstrings option.
llvm-svn: 102357
2010-04-26 17:59:24 +00:00
Daniel Dunbar 6171c4489d tests: Force a triple.
llvm-svn: 102332
2010-04-26 10:58:19 +00:00
Daniel Dunbar 710cb20cd6 IRgen/NeXT: Fix several alignment issues with Objective-C metadata symbols:
- Fix some places that had the alignment hard coded.
 - Use ABI type alignment, not preferred type alignment -- neither of this is exactly right, as we really want the C type alignment as required by the runtime, but the ABI alignment is a more correct choice.

This should be equivalent for x86_64, but fixes the alignment for ARM.

llvm-svn: 102314
2010-04-25 20:39:32 +00:00
Daniel Dunbar e4273bc38c tests: Convert test to FileCheck.
llvm-svn: 102313
2010-04-25 20:39:19 +00:00
Daniel Dunbar 5e63927d41 IRgen/NeXT: Reuse EmitImageInfo for both fragile and non-fragile ABI. This fixes Clang to correctly emit the "CorrectedSynthesize" bit when using the non-fragile ABI.
llvm-svn: 102312
2010-04-25 20:39:01 +00:00
Daniel Dunbar fca18c1b41 NeXT: Clean up dispatch method policy selection.
- Replace -cc1 level -fobjc-legacy-dispatch with -fobjc-dispatch-method={legacy,non-legacy,mixed}.

 - Lift "mixed" vs "non-mixed" policy choice up to driver level, instead of being buried in CGObjCMac.cpp.

 - No intended functionality change.

llvm-svn: 102255
2010-04-24 17:56:46 +00:00
Daniel Dunbar e3883874c5 NeXT/EH: When generating the rethrow code for a finally block, make sure to
chain outwards when inside a nested exception scope.
 - A real test for this is going into LLVM test-suite.

llvm-svn: 102204
2010-04-23 19:12:32 +00:00
Chris Lattner 9cffdf1331 don't slap noalias attribute on stret result arguments.
This mirror's Dan's patch for llvm-gcc in r97989, and
fixes the miscompilation in PR6525.  There is some contention
over whether this is the right thing to do, but it is the
conservative answer and demonstrably fixes a miscompilation.

llvm-svn: 101877
2010-04-20 05:44:43 +00:00
Fariborz Jahanian cf33091659 Make this test darwin10 specific.
llvm-svn: 101797
2010-04-19 18:27:05 +00:00
Fariborz Jahanian dfb3983525 Force clang to produce legacy api for messaging
in for pre-snowleoprd (NeXt runtime). Fixes
radar 7866951

llvm-svn: 101791
2010-04-19 17:53:30 +00:00
Fariborz Jahanian 7e9d52aaca Variation of objc_copyStruct API generation when
property (atomic/nonatomic) is of aggregate type with
gc'able member objects) (NeXT runtime).

llvm-svn: 101156
2010-04-13 18:32:24 +00:00
Fariborz Jahanian 33eb59a61b Remove this test for now until I can figure out
why it keeps failing on buildbot (but not for me).

llvm-svn: 101115
2010-04-13 02:16:35 +00:00
Fariborz Jahanian cb21e38dc5 Modify test to be darwin specific.
llvm-svn: 101109
2010-04-13 01:10:57 +00:00
Fariborz Jahanian 08b0f66d2e Add support for objc_copyStruct to enforce
atomicity of aggregate properties in setter/getter
methods. wip.

llvm-svn: 101107
2010-04-13 00:38:05 +00:00
Chris Lattner 509a32da75 fix PR6819
llvm-svn: 101050
2010-04-12 17:25:51 +00:00
Chris Lattner 7974fb130f fix this test.
llvm-svn: 101019
2010-04-12 05:47:20 +00:00
Chris Lattner c263f43ffd xfail this test for now.
llvm-svn: 101018
2010-04-12 05:44:13 +00:00
Chris Lattner 4806f7eb1f fix an invalid use of super, you can't use super like this in a block!
llvm-svn: 101017
2010-04-12 05:43:31 +00:00
Fariborz Jahanian d9235dbc02 Implement method type encoding in the presense
of c-style arguments. Completes radar 7445205.

llvm-svn: 100813
2010-04-08 21:29:11 +00:00
Devang Patel a2c048eaf8 Emit debug info for objc getters and setters.
llvm-svn: 100462
2010-04-05 21:09:15 +00:00
Fariborz Jahanian f9c4585c80 Fix a code gen. bug involving generation of getter method
from properties of _Complex type. (radar 7351147).

llvm-svn: 99558
2010-03-25 21:56:43 +00:00
Fariborz Jahanian 6c67b90752 Code gen for compound assignment of complex
types using property syntax to access setter/getters.
(also radar 7351147).

llvm-svn: 99307
2010-03-23 18:43:00 +00:00
Fariborz Jahanian 3131496622 Patch to implement code gen. use of compound assignent on
properties of complex type. Radar 7351147.

llvm-svn: 99299
2010-03-23 18:08:50 +00:00
Fariborz Jahanian 34f521ce9c Test for my last patch.
llvm-svn: 99194
2010-03-22 18:27:27 +00:00
Fariborz Jahanian eb1690d2bd Fix the test some more.
llvm-svn: 98090
2010-03-09 22:17:52 +00:00
Fariborz Jahanian 9d227a1d5e See if this test makes it though buildbot.
llvm-svn: 98087
2010-03-09 21:50:08 +00:00
Fariborz Jahanian 86048dc2e5 Reverse the code gen. enabled part of test until I can figure out
how to check the code pattern no matter how clang is built.

llvm-svn: 98079
2010-03-09 21:26:24 +00:00
Fariborz Jahanian 525f34133d Code gen test for a previous patch for
radar 7709015

llvm-svn: 98073
2010-03-09 19:15:10 +00:00
Fariborz Jahanian 281aae6328 Fix code gen bug generating code for
((id)cat)->isa. Fixes radar 7709015.

llvm-svn: 97672
2010-03-03 22:09:47 +00:00
John McCall 8ee376f08a Canonicalize parameter and return types before computing ABI info. Eliminates
a common source of oddities and, in theory, removes some redundant ABI
computations.  Also fixes a miscompile I introduced yesterday by refactoring
some code and causing a slightly different code path to be taken that
didn't perform *parameter* type canonicalization, just normal type
canonicalization;  this in turn caused a bit of ABI code to misfire because
it was looking for 'double' or 'float' but received 'const float'.

llvm-svn: 97030
2010-02-24 07:14:12 +00:00
Fariborz Jahanian 40efb08d87 Remove this test for now.
llvm-svn: 96651
2010-02-19 01:40:48 +00:00
Fariborz Jahanian ad238e2bde XFAIL until I can fugure out how test check for a pattern when
clang is built optimized.

llvm-svn: 96645
2010-02-19 01:11:52 +00:00
Fariborz Jahanian aef662206b Patch removes IVars list from ObjCInterfaceDecl and
instead relies on their DeclContext for iteration, etc.

llvm-svn: 96638
2010-02-19 00:31:17 +00:00
Fariborz Jahanian 46dbcb2f86 Hopefully make buildbot happy.
llvm-svn: 96513
2010-02-17 21:01:05 +00:00
Fariborz Jahanian 999ddbcf8e Patch to remove arbitrary imporation of 'self' into
a block without it being used. This causes over release
of objects in certain runtime-senitive apps.
(fixes radar 7581175).

llvm-svn: 96501
2010-02-17 19:54:08 +00:00
Fariborz Jahanian 989908fbac Generate the objc_read_weak API when calling
a __weak block. Fixes radar 7628591.

llvm-svn: 95822
2010-02-10 23:34:57 +00:00
Daniel Dunbar 3241d400c8 Switch to using -fsjlj-exceptions instead of hard-coding it. Notably, this fixes
calls to the UnwindResumeOrRethrow function for C++/Obj-C exception handling,
for Darwin ARM.

llvm-svn: 95787
2010-02-10 18:49:11 +00:00
Fariborz Jahanian df506b934e Fix a code gen bug accessing 'isa' field via a message call
(Fixes radar 7609722).

llvm-svn: 95406
2010-02-05 19:18:30 +00:00
Fariborz Jahanian 08d614d92e Fix DeclContext of an objective-c @catch variable
declaration. Fixes radar 7590273.

llvm-svn: 95164
2010-02-03 00:01:43 +00:00
Daniel Dunbar ca5e3eb7f7 NeXT: Add support for -fobjc-legacy-dispatch.
llvm-svn: 95005
2010-02-01 21:07:33 +00:00
Daniel Dunbar d86666ffd7 Driver/Darwin: Stuff iPhoneOS into environment portion of the (llvm/clang) triple instead of keying off architecture. Also, fix version define to properly include the revision/micro component of the version number.
llvm-svn: 94487
2010-01-26 01:44:04 +00:00
Chris Lattner 1df52e7d6a merge another one in.
llvm-svn: 94404
2010-01-25 03:38:26 +00:00
Chris Lattner fe28ef686e consolidate two testcases.
llvm-svn: 94403
2010-01-25 03:37:52 +00:00
Chris Lattner 83b0dd16c3 fix rdar://7556129 a crash in blocks debug info codegen.
llvm-svn: 94402
2010-01-25 03:34:56 +00:00
Anders Carlsson 1749083e2e Fill in the return value slot in CGExprAgg::VisitCallExpr. This takes us halfway towards fixing PR5824.
llvm-svn: 92142
2009-12-24 20:40:36 +00:00
Anders Carlsson b2d47e0eaa Add a test for x86-64 struct returns under gc.
llvm-svn: 92140
2009-12-24 20:21:41 +00:00
Sean Callanan 12ca3f46d8 Testcase fixes to reflect instruction table changes in the LLVM backend
(http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20091214/092780.html)
The instruction fixes were checked and approved by Chris Lattner, but
these testcase fixes are mine; please yell at me if there are any
problems with either.

* PR5050-constructor-conversion.cpp
* array-construction.cpp
* constructor-conversion.cpp
* cast-conversion.cpp
* constructor-default-arg.cpp
* derived-to-base-conv.cpp
* ptr-to-member-function.cpp
* call-arg-zero-temp.cpp
* default-destructor-synthesis.cpp
* global-array-destruction.cpp
* array-operator-delete-call.cpp
* decl-ref-init.cpp
* default-constructor-for-members.cpp
* convert-to-fptr.cpp
* constructor-for-array-members.cpp
* conversion-function.cpp
* objc-read-weak-byref.m
	Fixed testcase to reflect call qualifier

llvm-svn: 91640
2009-12-18 00:04:09 +00:00
Daniel Dunbar 5618e98f33 Update tests to use %clang instead of 'clang', and forcibly disable use of '
clang ' or ' clang -cc1 ' or ' clang-cc ' in test lines (by substituting them to
garbage).

llvm-svn: 91460
2009-12-15 22:01:24 +00:00
Fariborz Jahanian 2b9fc83db5 Fixes a code gen bug related to accessing a now
non-existing 'isa' field of a non-existing struct type
all related to legacy type definition for 'id' which we have
dropped in clang in favor of a built-in type.
(fixes radar 7470820).

llvm-svn: 91455
2009-12-15 21:34:52 +00:00
Daniel Dunbar 8fbe78f6fc Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

llvm-svn: 91446
2009-12-15 20:14:24 +00:00
Fariborz Jahanian 3914ee8fcd Make test more generic.
llvm-svn: 91349
2009-12-14 22:17:35 +00:00
Fariborz Jahanian 9ac0a04b29 Patch to fix 32-bit @try failure with internal assertion when compiling
an Objective-C rethrow nested inside another try/catch block. (fixes radar 7466728).

llvm-svn: 91335
2009-12-14 21:35:01 +00:00
Fariborz Jahanian d83359ac82 Make test pass in all cases.
llvm-svn: 91309
2009-12-14 18:38:32 +00:00
Fariborz Jahanian df9f4c6655 Fixes an incomplete test case.
llvm-svn: 91304
2009-12-14 18:18:29 +00:00
Fariborz Jahanian 4ee3981574 Tests use the new clang.
llvm-svn: 91290
2009-12-14 17:13:18 +00:00
Daniel Dunbar 85d2f8f875 Use clang -cc1 in test, to improve determinism.
llvm-svn: 91236
2009-12-13 02:20:49 +00:00
Fariborz Jahanian 751c1e7b24 patch to add a property from a protocol to a class that adopts the protocol.
(fixes radar 7466494).

llvm-svn: 91227
2009-12-12 21:26:21 +00:00
Fariborz Jahanian 531c16f9fb Code gen for ObjCIsaExpr AST used as lvalue.
(fixes radar 7457534).

llvm-svn: 90995
2009-12-09 23:35:29 +00:00
Fariborz Jahanian a5fee26d28 Codegen. support for ObjCIsaExpr AST which until now
was not needed (fixes radar 7453430).

llvm-svn: 90981
2009-12-09 19:05:56 +00:00
Fariborz Jahanian a6227fd896 (objc2 nonfragile-abi specific). If the translation unit includes an implementation
of a subclass (direct or indirect) of a weak_import root class, emit a weak reference 
for the root class's metaclass (should complete radar 6815425).

llvm-svn: 90249
2009-12-01 18:25:24 +00:00
Fariborz Jahanian 89b660c774 Fix a crash when ivar type is a __strong SEL. Fallout from
recent change to make SEL a builtin type (fixes radar 7425510).

llvm-svn: 90145
2009-11-30 18:43:52 +00:00
Daniel Dunbar e97582406b Use '-FOO' 'BAR' instead of '-FOO=BAR' for FOO in -stack-protector, -fvisibility, and -fconstant-string-class.
llvm-svn: 90072
2009-11-29 09:33:20 +00:00
Daniel Dunbar 4e7596cc3a Normalize options to use '-FOO' instead of '--FOO'.
llvm-svn: 90071
2009-11-29 09:33:10 +00:00
Fariborz Jahanian 04b258cc9e Allow user re-definition of SEL as well as accessing its fields.
This fixes pr5611.

llvm-svn: 89895
2009-11-25 23:07:42 +00:00
Fariborz Jahanian d25c219475 Fixe a crash in encoding of SEL type caused by recent changes.
llvm-svn: 89696
2009-11-23 20:40:50 +00:00
David Chisnall 27033c9171 Test case for bug fixed in r89457.
llvm-svn: 89605
2009-11-22 17:42:02 +00:00
Fariborz Jahanian 252ba5fb6f This patch implements objective-c's 'SEL' type as a built-in
type and fixes a long-standing code gen. crash reported in
at least two PRs and a radar. (radar 7405040 and pr5025). 
There are couple of remaining issues that I would like for
Ted. and Doug to look at:

Ted, please look at failure in Analysis/MissingDealloc.m.
I have temporarily added an expected-warning to make the
test pass. This tests has a declaration of 'SEL' type which
may not co-exist with the new changes.

Doug, please look at a FIXME in PCHWriter.cpp/PCHReader.cpp.
I think the changes which I have ifdef'ed out are correct. They
need be considered for in a few Indexer/PCH test cases.

llvm-svn: 89561
2009-11-21 19:53:08 +00:00
Fariborz Jahanian 95ace55701 This patch finalizes implementatin of weak_import
objective-c2 classes (radar 6815425).

llvm-svn: 89157
2009-11-17 22:42:00 +00:00
Daniel Dunbar f386ce5429 ... and add back a few more triple forces.
llvm-svn: 89088
2009-11-17 10:27:58 +00:00
Daniel Dunbar cba26d4dc5 Add some -triples I was a little too liberal in removing.
llvm-svn: 89084
2009-11-17 10:04:38 +00:00
Daniel Dunbar 7e4ae04bed Merge several visibility tests into hidden-visibility.m, and check .ll output
not .s output.

llvm-svn: 89083
2009-11-17 10:04:28 +00:00
Daniel Dunbar fba0b44d35 Use -fblocks and -fobjc-nonfragile-abi when that is what is being tested, instead of forcing the triple.
llvm-svn: 89072
2009-11-17 09:04:12 +00:00
Daniel Dunbar feedba68b5 Don't #include <stdio.h> when tests don't need it, or use clang instead of clang-cc when they do.
llvm-svn: 89070
2009-11-17 08:57:36 +00:00
Daniel Dunbar 4656c53e12 Move -fnext-runtime defaulting to driver (and change clang-cc default to
-fnext-runtime), instead of using getDefaultLangOptions.

llvm-svn: 89058
2009-11-17 07:07:28 +00:00
Fariborz Jahanian 9290ede494 Handle case of missing '@end' in implementation context
gracefully, on par with gcc, by: Issuing a warning,
doing final sematinc check of its definitions and generating
its meta-data.

llvm-svn: 88934
2009-11-16 18:57:01 +00:00
Fariborz Jahanian eb80c98a72 Fix a code gen bug in i386-apple-darwin (objc fragile abi), sending
message to 'super'. Fixes radar 7205866.

llvm-svn: 87017
2009-11-12 20:14:24 +00:00
Daniel Dunbar 34546ce43d Remove RUN: true lines.
llvm-svn: 86432
2009-11-08 01:47:25 +00:00
Daniel Dunbar 8b57697954 Eliminate &&s in tests.
- 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious.

llvm-svn: 86430
2009-11-08 01:45:36 +00:00
Daniel Dunbar a530841b4f Switch XFAIL format to match LLVM.
llvm-svn: 85880
2009-11-03 07:25:45 +00:00
Steve Naroff f0c8611d3f Fix <rdar://problem/7330784>. Avoid crashing on 'Class<p>' when generating meta-data for a class.
llvm-svn: 85440
2009-10-28 22:03:49 +00:00
Daniel Dunbar c14753b781 Fix crash when synthesizing property setters when the property type and ivar
type have mismatched Objective-C types.
  - <rdar://problem/7336352> [irgen] crash in synthesized property construction

llvm-svn: 85275
2009-10-27 19:21:30 +00:00
Devang Patel 232f278fc1 Disable tests that check debug info intrinsic. This does not work if debug info intrinsics are not used to encode debug info.
llvm-svn: 83929
2009-10-12 23:46:58 +00:00
Fariborz Jahanian 07ca72725a Generate weak read barriers when reading a weak __block
variable inside the block.

llvm-svn: 83729
2009-10-10 20:07:56 +00:00
Mike Stump f8c1f0d1f0 Speed up testing by avoiding stdio.h, also helps testing on windows.
Patch by John Thompson.

llvm-svn: 83593
2009-10-08 23:05:06 +00:00
Fariborz Jahanian 092cd6e624 Patch to implement Protocols on class extensions.
<rdar://problem/7269631> Protocols on class extensions don't work

llvm-svn: 83322
2009-10-05 20:41:32 +00:00
Fariborz Jahanian e01e434aef <rdar://problem/7263113> Make clang produce gcc's objc_assign_StrongCast as a result of type-cast of an ivar in assignment.
llvm-svn: 83150
2009-09-30 17:10:29 +00:00
Anders Carlsson 0374742326 Use ABIArgInfo::getDirect() for all types that have a pointer representation.
llvm-svn: 82845
2009-09-26 03:56:53 +00:00
John McCall 6cb02c1d7e Add a reduced test case for the weak ivar infinite recursion.
llvm-svn: 82747
2009-09-25 02:18:37 +00:00
Daniel Dunbar 0512647362 Force triple in test.
llvm-svn: 82519
2009-09-22 03:50:39 +00:00
Daniel Dunbar a25a9dff0d Add test case for PR4894 (it was fixed in LLVM).
llvm-svn: 82510
2009-09-22 02:18:40 +00:00
Fariborz Jahanian 71848a3ff1 Removed -fobjc-newgc-api option. clang now conforms to
gcc-style write-barrier api only.

llvm-svn: 82493
2009-09-21 23:03:37 +00:00
Fariborz Jahanian a74039426d -fobjc-newgc-api is now the default.
llvm-svn: 82478
2009-09-21 20:17:37 +00:00
Fariborz Jahanian 38c3ae9bc4 Miscellanous fixes in generatation of objc gc's write-barriers.
llvm-svn: 82472
2009-09-21 18:54:29 +00:00
Daniel Dunbar 23c1ae7fae Force a triple.
llvm-svn: 82216
2009-09-18 08:46:07 +00:00
Fariborz Jahanian 2e32ddc7ba Fixed a bug in generation of the new write-barriers when
array syntax is used to derefernce and assign to ivar pointee.

llvm-svn: 82183
2009-09-18 00:04:00 +00:00
Daniel Dunbar 51418c3b90 Force triple for tests using __strong.
llvm-svn: 82133
2009-09-17 07:21:40 +00:00
Daniel Dunbar df0e62d0a1 IRgen/ObjC: Correctly construct the function info for variadic message sends.
This fixes some bad -O0 codegen and the unnecessary clearing of al on entry to objc_msgSend for most message sends.

<rdar://problem/7102824> [irgen] unnecessary xorb on calls to objc_msgSend on x86_64

llvm-svn: 82118
2009-09-17 04:01:40 +00:00
Daniel Dunbar db7ec04fed Force triple, although probably the real fix is to tie __strong to -fobjc-gc.
llvm-svn: 82101
2009-09-17 00:28:00 +00:00
Fariborz Jahanian 1ff8299c67 Removed useless stuff from the test.
llvm-svn: 82095
2009-09-16 23:52:53 +00:00
Fariborz Jahanian 0bdc001b6e More test for objc gc's mixed write-barriers.
llvm-svn: 82094
2009-09-16 23:49:04 +00:00
Fariborz Jahanian e29f04859b Additional tests for write-bariers.
llvm-svn: 82092
2009-09-16 23:38:26 +00:00
Fariborz Jahanian 5f41a8c4af Test for variety of write-barriers.
llvm-svn: 82091
2009-09-16 23:30:59 +00:00
Fariborz Jahanian de1d324dce patch for generating objc'2 objc_assign_ivar. WIP.
llvm-svn: 82090
2009-09-16 23:11:23 +00:00
Fariborz Jahanian a7fa6beb2e Starting patch to generate more specific API for objc's
GC. Currently, new API will be generated under
clang-cc's -fobjc-newgc-api flag which will eventually
become the default. WIP.

llvm-svn: 82082
2009-09-16 21:37:16 +00:00
Fariborz Jahanian cceedbff27 Do not generate write-barrier in indirect assignment to
a weak object.

llvm-svn: 82061
2009-09-16 18:09:18 +00:00
Daniel Dunbar 42684d5af8 Force triple to avoid spurious differences due to runtime choice.
llvm-svn: 81666
2009-09-13 01:45:29 +00:00
Fariborz Jahanian 8d6298b272 Fix a regression where write-barrier was not being generated
for block pointer.

llvm-svn: 81479
2009-09-10 23:38:45 +00:00
Fariborz Jahanian 2cde203392 Non fragile ABI for GNU runtime. Patch bu David Chisnall.
llvm-svn: 81462
2009-09-10 21:48:21 +00:00
Fariborz Jahanian 063c7720f4 More objc GC's API work for array of pointers declared
as __strong.

llvm-svn: 81283
2009-09-08 23:38:54 +00:00
Fariborz Jahanian b17a190186 Fixes a regression in generating objc's GC API
in assiging to c pointer types with a GC'able
attribute.

llvm-svn: 81244
2009-09-08 19:45:47 +00:00
Anders Carlsson 2fb0824197 Vastly improve PredefinedExpr output, both in Sema and CodeGen. Patch by Sam Weinig!
llvm-svn: 81237
2009-09-08 18:24:21 +00:00
Fariborz Jahanian f0ff9832ba Test for generation of objc_assign_strongCast in a variety of
situations.

llvm-svn: 81129
2009-09-06 19:44:57 +00:00
Fariborz Jahanian 1a50477385 Fixed a property getter ir-gen crash.
llvm-svn: 80681
2009-09-01 17:02:21 +00:00