Commit Graph

424 Commits

Author SHA1 Message Date
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