Commit Graph

282 Commits

Author SHA1 Message Date
Fariborz Jahanian 2794ad59aa objective-c modern translator: synthesize argument type
correctly for blocks and function pointer arguments
in the written constructor.  // rdar://11359268

llvm-svn: 159456
2012-06-29 19:55:46 +00:00
Fariborz Jahanian 4a031bdc8f objective-c modern translator: Translation into objc_msgSend_stret
entry point which requires nil check before calling objc_msgSend_stret.
// rdar://11359268 - wip.

llvm-svn: 159445
2012-06-29 18:27:08 +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 9b43c3f0c5 modern objc translation: Add translation of @autoreleasepool
statement. // rdar://11474836.

llvm-svn: 157359
2012-05-23 23:47:20 +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 b6e9b6cfe7 Test for previously checked in patch.
// rdar://11374235

llvm-svn: 156552
2012-05-10 17:05:15 +00:00
Fariborz Jahanian 44645837bc Remove this test again which fails the build-bot for reasons yet
unknown to me.

llvm-svn: 156480
2012-05-09 17:18:19 +00:00
Fariborz Jahanian cbabea83d4 Re-add test for // rdar://11374235
llvm-svn: 156477
2012-05-09 16:15:46 +00:00
Fariborz Jahanian f60f5ee43d Remove thid test for now.
llvm-svn: 156455
2012-05-09 00:27:52 +00:00
Fariborz Jahanian 89919ccd17 Modern objective-c translation. Translating default
synthesis of property getter/setters. // rdar://11374235

llvm-svn: 156447
2012-05-08 23:54:35 +00:00
Fariborz Jahanian 9c0c0501e8 modern objc translation. objc_getClass() and objc_getMetaClass()
prototypes should both return  `struct objc_class *`.
// rdar://11375495

llvm-svn: 156418
2012-05-08 20:55:55 +00:00
Douglas Gregor 8a59a957fb Revert r156097, which appears to be causing some breakage.
llvm-svn: 156304
2012-05-07 14:17:47 +00:00
Fariborz Jahanian e9863b5c8e objc modern translator: fix up attribute for dynamic property in a category.
// rdar://11095151

llvm-svn: 156127
2012-05-03 23:19:33 +00:00
Fariborz Jahanian f687e7b2ff modern objc translator: support for default property
synthesis translation. // rdar://11374235 - wip.

llvm-svn: 156125
2012-05-03 22:52:13 +00:00
Fariborz Jahanian 2e7f638b23 modern objc translator: used size_t in couple
of places. // rdar://11375908

llvm-svn: 156106
2012-05-03 21:44:12 +00:00
Fariborz Jahanian 3dc3669858 modern objc translation. objc_getClass() and objc_getMetaClass()
prototypes should both return  `struct objc_class *`.
// rdar://11375495

llvm-svn: 156097
2012-05-03 20:23:37 +00:00
Fariborz Jahanian d7c6777d50 Modern objective-c translation: Fixing couple of bugs
related to laying out ivar structs and accessing non-fragile-ivar
in more compilated cases. // rdar://11323187

llvm-svn: 156004
2012-05-02 17:34:59 +00:00
Fariborz Jahanian 144b72288a modern objective-c translation of private ivars.
// rdar://11351299

llvm-svn: 155921
2012-05-01 17:46:45 +00:00
NAKAMURA Takumi 9a66002356 clang/test/Rewriter: Remove XFAIL and add -U__declspec to other 9 tests. mingw32 tends to define built-in __declspec.
llvm-svn: 155911
2012-05-01 10:52:06 +00:00
NAKAMURA Takumi 5f9e2bfa94 clang/test/Rewriter/rewrite-modern-extern-c-func-decl.mm: Remove XFAIL and add -U__declspec. mingw32 tends to define built-in __declspec.
llvm-svn: 155910
2012-05-01 10:51:55 +00:00
Fariborz Jahanian faded5bb0f modern objective-c translator. named aggregate types
defined inside the objc class belong to class's
decl. scope. This is to conform to objective-c
rules. // rdar://11351299

llvm-svn: 155855
2012-04-30 23:20:30 +00:00
Fariborz Jahanian bf217c8c14 objective-c modern translator: Correctly translate
nonfragile ivar access code when ivar type is a 
locally defined struct/union type. // rdar://11323187

llvm-svn: 155740
2012-04-27 22:48:54 +00:00
NAKAMURA Takumi f906329eef test/Rewriter: Mark 4 tests as XFAIL:mingw32, due to predefined __declspec(a) issue.
llvm-svn: 155692
2012-04-27 04:36:34 +00:00
Fariborz Jahanian 16d0d6c4ad modern objective-c transltion: Fixes a translation bug
of writing a __block variable being initialized with
a constructed object. // rdar://11326988

llvm-svn: 155673
2012-04-26 23:20:25 +00:00
Fariborz Jahanian 94ee181e08 objective-c modern translator: more tests.
llvm-svn: 155585
2012-04-25 20:48:00 +00:00
Fariborz Jahanian 78731c7098 improve a modern objc translator test.
llvm-svn: 155569
2012-04-25 18:11:57 +00:00
Fariborz Jahanian e49a42cae9 modern objc rewriter: fixes a bug writing
a const qualified static c-function. 
// rdar://11314329

llvm-svn: 155564
2012-04-25 17:56:48 +00:00
Fariborz Jahanian 847713a998 modern objc translator: Allow writing of multiple
declaration of __block variables on same lines
with initializers. // rdsr://7547630

llvm-svn: 155473
2012-04-24 19:38:45 +00:00
Fariborz Jahanian 32af25ea05 objc modern rewriter: allow translation of
multiple declaration of block variables
(with no initializer) on the same line.

llvm-svn: 155462
2012-04-24 18:16:20 +00:00
NAKAMURA Takumi 8701d38c93 clang/test/Rewriter/objc-modern-boxing.mm: Mark as XFAIL:mingw for now, due to predefined __declspec similar to r155278.
llvm-svn: 155417
2012-04-24 01:19:04 +00:00
NAKAMURA Takumi c6fbdf027f clang/test/Rewriter/rewrite-modern-extern-c-func-decl.mm: Mark as XFAIL:mingw for now, due to predefined __declspec.
It could be tweaked to add -triple i686-win32, though.

llvm-svn: 155278
2012-04-21 09:39:58 +00:00
Fariborz Jahanian 440b524b46 minor improvement to couple of tests.
llvm-svn: 155204
2012-04-20 17:07:07 +00:00
Fariborz Jahanian df0577de11 objective-c modern translator: Further improving the last
patch fixing writing a spurious 'static' into
the wrong place. // rdar://11275241

llvm-svn: 155130
2012-04-19 16:30:28 +00:00
Fariborz Jahanian ca357d9831 modern objective-c translator: Fix writing a spurious 'static'
into the wrong place when rewriting a static function
which declares block literals. // rdar://11275241

llvm-svn: 155084
2012-04-19 00:50:01 +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
Fariborz Jahanian 88773764e9 objective-c modern translation. Correct rewriting of
block meta-data of block literals declared inside
of extern "C" functions.
// rdar://1131490

llvm-svn: 154939
2012-04-17 18:40:53 +00:00
Fariborz Jahanian 35f6e12bf0 Modern objective-c translator:'self' used inside
block literal is imported. // rdar://11259664

llvm-svn: 154876
2012-04-16 23:00:57 +00:00
Fariborz Jahanian cc1722818b modern objective-c translator: translation of implicit
cast to/from block pointer types. // rdar://11202764
Also, many more modern translator tests.

llvm-svn: 154869
2012-04-16 22:14:01 +00:00
Fariborz Jahanian 29898f4565 objective-c modern translator: buildit objc bool
type for rewriter project will be BoolTy.
// rdar://11231426. 

llvm-svn: 154861
2012-04-16 21:03:30 +00:00
Fariborz Jahanian 1b085428e8 objective-c modern translator: Make metadata
definition for protocols static. // rdar://11248048

llvm-svn: 154753
2012-04-14 17:13:08 +00:00
Fariborz Jahanian 3a5d552cd7 modern objective-c translator: Fixes translation of
__typeof which is a regression by reverting
r154360. // rdar://11233924

llvm-svn: 154679
2012-04-13 18:00:54 +00:00
Fariborz Jahanian 4af0e9efdd modern objective-c translator: When translating
call to 'super' use __rw_objc_super as type of the
'super' meta-data instead of objc_super.
// rdar://11239894

llvm-svn: 154670
2012-04-13 16:20:05 +00:00
Fariborz Jahanian 30c3de97a9 objective-c numeric literal: type of boolean is
that of typedef BOOL if found.
// rdar://11231426

llvm-svn: 154595
2012-04-12 17:49:18 +00:00
Fariborz Jahanian e1240fe743 modern objective-c translator. ifdef'out
__weak and __block when rewriting.
// rdar://11236342

llvm-svn: 154592
2012-04-12 16:33:31 +00:00
Fariborz Jahanian 5811fd6cc4 modern objective-c translator. Fixes a mis-translation when
of a __block struct object. // rdar://11230308

llvm-svn: 154566
2012-04-11 23:57:12 +00:00
Fariborz Jahanian aaf4d69ac1 modern objective-c translator. Fixes a translation bug when
first ivar in the list is a bitfield.
// rdar://11229770

llvm-svn: 154534
2012-04-11 21:12:36 +00:00
Fariborz Jahanian 31176b1485 modern objective-c translation: writing container
subscripting. // rdar://11203853

llvm-svn: 154441
2012-04-10 22:06:54 +00:00
Fariborz Jahanian 2c00acd67f objective-c modern translator: rewriting specific
implicit casts which is needed to produce good c++
code. // rdar://11202764

llvm-svn: 154360
2012-04-10 00:08:18 +00:00
Fariborz Jahanian 668b9e9c65 more testing of objc's dictionary literal translation.
llvm-svn: 154220
2012-04-06 22:51:48 +00:00
Fariborz Jahanian 4460e0f805 modern objective-c translation: support for
dictionary literals. This concludes // rdar://10803676

llvm-svn: 154218
2012-04-06 22:29:36 +00:00
Fariborz Jahanian e110fe4ac7 modern objective-c translator: translate array literal
expressions. // rdar://10803676

llvm-svn: 154196
2012-04-06 19:47:36 +00:00
Fariborz Jahanian 08ed8921c7 modern objective-c translator: rewriter linkage spec.
// rdar://11169733

llvm-svn: 153960
2012-04-03 17:35:38 +00:00
Fariborz Jahanian 9c967fe51b modern objective-c translator: writing numeric
literals. // rdar://10803676

llvm-svn: 153756
2012-03-30 16:49:36 +00:00
Fariborz Jahanian 8f7c1d32a8 modern objc translator: additional test.
llvm-svn: 153669
2012-03-29 18:20:51 +00:00
Fariborz Jahanian f35e020ef3 modern objective-c translator: fix up assortment of
visibility directives for a variety of exported
meta-data symbols. // rdar://11144048

llvm-svn: 153663
2012-03-29 17:51:09 +00:00
Fariborz Jahanian 307b7ad50c modern objective-c translator: writing objc boolean literals.
// rdar://11124775

llvm-svn: 153535
2012-03-27 20:17:30 +00:00
Fariborz Jahanian 5ed21c3154 objective-c modern translator: move all inithooks into a single array
// rdar://11124354

llvm-svn: 153526
2012-03-27 18:41:05 +00:00
Fariborz Jahanian 38c59108ad Commit patch reverted in r153454 with the modified test
case that I forgot to check in.

llvm-svn: 153512
2012-03-27 16:21:30 +00:00
Fariborz Jahanian e005070ccf modern objc translation of block literal expressions
declared at file scope.
// rdar://11006566

llvm-svn: 153293
2012-03-23 00:00:49 +00:00
Fariborz Jahanian bdf975ea3f modern objc rewriter: until we can translate block literals
at global scope properly, issue diagnostics.

llvm-svn: 153271
2012-03-22 19:54:39 +00:00
Fariborz Jahanian ee1db7a0fd modern objective-c rewriter: Fix up translation of
property attributes. // rdar://11095151

llvm-svn: 153261
2012-03-22 17:39:35 +00:00
Fariborz Jahanian cd79a49f37 modern objective-c translator: add static function to initialize
the class pointer in the category structure.
// rdar://11076938

llvm-svn: 153138
2012-03-20 21:41:28 +00:00
Fariborz Jahanian 40ca00dc4c modern objective-c translator: provide meta-data initialization
via functions for certain pointer initialization
fields. // rdar://11076938

llvm-svn: 153117
2012-03-20 19:54:33 +00:00
Fariborz Jahanian 6e60c1376f modern objective-c translator: couple of minor
changes to how meta-data is declared. 
// rdar://11076938

llvm-svn: 153098
2012-03-20 17:34:50 +00:00
Fariborz Jahanian a854174a23 objective-c modern translator: Refactor intername ivar names to
one place and use it throughout. Also, change ivar name to avoid
name collisions. // rdar://11079366

llvm-svn: 153093
2012-03-20 17:13:39 +00:00
Fariborz Jahanian 3466059001 modern objective-c translator: fix type of objc_exception_throw
declaration and its siblings.

llvm-svn: 153043
2012-03-19 18:11:32 +00:00
Fariborz Jahanian e8810768a9 modern objective-c rewriter: further improvement in
writing @synchronized statement; do not call locking
expression more than once and support early exits in
@synchronized's statement block (such as return).

llvm-svn: 152993
2012-03-17 17:46:02 +00:00
Fariborz Jahanian fe6268e34a modern objective-c translator: write @synchronized.
// rdar://11063663

llvm-svn: 152949
2012-03-16 21:33:16 +00:00
Fariborz Jahanian 52fe6a0da3 modern objective-c translator: writing @throw statement.
llvm-svn: 152931
2012-03-16 16:52:06 +00:00
Fariborz Jahanian b960db4427 modern objective-c translation: writing @try/@catch/@finally
statements.

llvm-svn: 152875
2012-03-15 23:50:33 +00:00
Fariborz Jahanian 3b71b17753 modern objective-c translator: writing @try/@finally statement.
llvm-svn: 152867
2012-03-15 22:42:15 +00:00
Fariborz Jahanian f232bb421a modern objective-c translator: rewriting of @catch-stmt.
llvm-svn: 152830
2012-03-15 20:11:10 +00:00
NAKAMURA Takumi 1e5ec2fcb4 test/Rewriter/rewrite-modern-ivars-2.mm: Add "-triple i386-apple-darwin9".
llvm-svn: 152476
2012-03-10 03:02:29 +00:00
Fariborz Jahanian c2e2ad6486 objective-c modern rewriter. More fixes related to rewriting
ivars in the modern rewriter.

llvm-svn: 152451
2012-03-09 23:46:23 +00:00
Fariborz Jahanian d7a3261dfb objective-c modern translator. Don't ignore unnamed bitfields
when rewriting.

llvm-svn: 152123
2012-03-06 17:16:27 +00:00
Fariborz Jahanian 265a421dd9 Modern objective-c translator. rewriting ivars of aggregate type.
llvm-svn: 151662
2012-02-28 22:45:07 +00:00
Fariborz Jahanian 7e75de84bd test for writing modern ivar of struct type.
llvm-svn: 151378
2012-02-24 18:17:50 +00:00
Fariborz Jahanian 5e6842bfea more objective-c modern translator ivar tests.
llvm-svn: 151376
2012-02-24 18:03:42 +00:00
Fariborz Jahanian dd5a59baed objc modern translator. Fixes writing of block pointer ivar access.
llvm-svn: 151371
2012-02-24 17:35:35 +00:00
Fariborz Jahanian eee9bca03d Add an ivar test for modern objc abi translator.
llvm-svn: 151316
2012-02-24 00:34:58 +00:00
Fariborz Jahanian 77a9255329 Make test works with FileCheck.
llvm-svn: 151314
2012-02-24 00:29:20 +00:00
Fariborz Jahanian 77171d343b another test for modern ivar access rewrite.
llvm-svn: 151208
2012-02-22 22:32:05 +00:00
Fariborz Jahanian 31ebebfb58 more tests for modern objc translator.
llvm-svn: 151201
2012-02-22 21:13:49 +00:00
Fariborz Jahanian 5e49eb95b5 modern objc translator. more writing of modern ivar access
abi.

llvm-svn: 151176
2012-02-22 18:13:25 +00:00
Fariborz Jahanian 8e1118cbd5 modern objc translator: fixes a bug where a class declaration with not
any implementation in tu was not being translated.

llvm-svn: 151106
2012-02-21 23:58:41 +00:00
Fariborz Jahanian c481c0c0f5 objective-c modern translator. accessing ivars using modern abi - wip.
llvm-svn: 151103
2012-02-21 23:46:48 +00:00
Fariborz Jahanian a7765fea90 modern objc translator. Finish off first cut of the
modern meta-data translation by commenting out private ivar
declarations in user source. Also, added several tests.

llvm-svn: 150985
2012-02-20 20:09:20 +00:00
Argyrios Kyrtzidis 75627ad8ba Fix the rewriter that broke with r149987.
r149987 changed the way parsing happens inside an @implementation;
it aggregates the declarations inside and reports them together as a DeclGroup.
This had the side effect that function declarations were reported together with
their definition, while the rewriter expected for function declarations to be
reported immediately to the consumer and thus not have a body.

Fix this by having the rewriter actually check with isThisDeclarationADefinition()
to make sure the body comes from the current decl before rewriting it.

llvm-svn: 150325
2012-02-12 04:48:45 +00:00
Fariborz Jahanian 42d05f2faf Also, these objc++ rewriter tests are meant to run in NeXt's
fragile-abi mode.

llvm-svn: 149788
2012-02-04 19:06:06 +00:00
Fariborz Jahanian 27062dd7d2 These tests are intended to run in NeXt's legacy objective-c abi (fragile-abi).
Make this explicit since default is now nonfragile-abi.

llvm-svn: 149787
2012-02-04 18:56:43 +00:00
Jean-Daniel Dupas 400dd1c3d0 Remove the "C" in "implicitly declaring C library function" diagnostic
because all functions are not C functions (i.e. NSLog).

llvm-svn: 149150
2012-01-27 23:21:02 +00:00
Fariborz Jahanian 87b4ae6cab objective-c: Use class definition AST in several situations when
building related objc ASTs which require a class definition AST.
These were uncovered when testing objc rewriter.

llvm-svn: 147210
2011-12-23 00:31:02 +00:00
Fariborz Jahanian a4b2a86353 objc, objc rewriter. Fixes couple of bugs one
because of recent refactoring and one in the
rewriter.

llvm-svn: 147070
2011-12-21 19:48:07 +00:00
Argyrios Kyrtzidis 78181b4b45 Fix the rewriter, rdar://10234024.
llvm-svn: 141201
2011-10-05 19:37:56 +00:00
Fariborz Jahanian 9f0bc5757c objc rewriter - more fixes to support compiling the rewritten
test case having instancetype. Fix in rewriter is unrelated to
using of instancetype. Test case uses other feature not yet
supported in the rewriter. There is more work to do, but this
is an ongoing task and not urgent at this time.

llvm-svn: 139473
2011-09-10 17:01:56 +00:00
Fariborz Jahanian e1378a4313 objc rewriter - Add rewriter test for new instancetype
along with minor rewriter fix to handle that. This
test is still incomplete due to rewriter issues
unrelated to instancetype.

llvm-svn: 139403
2011-09-09 20:35:22 +00:00
Fariborz Jahanian abc11aa3bc Fix a rewriter bug caused by recent changes in objc's
group decls.

llvm-svn: 138772
2011-08-29 22:21:46 +00:00
Fariborz Jahanian 3a039e339f objective-c: Treat top-level objective-c declarations
, such as list of forward @class decls, in a DeclGroup
node. Deal with its consequence throught clang. This
is in preparation for more Sema work ahead. // rdar://8843851.
Feel free to reverse if it breaks something important
and I am unavailable.

llvm-svn: 138709
2011-08-27 20:50:59 +00:00
Fariborz Jahanian 9e7dbd1cc6 objc rewriter: Fixes a rewriting of implicit casting of an integral
argument to bool. // rdar://9899834

llvm-svn: 136946
2011-08-04 23:58:03 +00:00
Fariborz Jahanian c7c346fd13 objective-c rewrite: Fixes rewriting of objective-c collection
statement inside a block. // rdar://9878420

llvm-svn: 136717
2011-08-02 20:28:46 +00:00