Commit Graph

234 Commits

Author SHA1 Message Date
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
Fariborz Jahanian c81decc0f5 Test for // rdar://9846759
llvm-svn: 136602
2011-07-31 20:27:31 +00:00
Fariborz Jahanian fae2e8df37 Fixup more objc rwriter bug having to do with
rewriting of blocks which have objective-c
stuff which need be rewritten as well. // rdar://9254348

llvm-svn: 129300
2011-04-11 21:17:02 +00:00
Fariborz Jahanian eae9c0e3df Fixes a rewrting bug of a property-dot syntax expression inside
a block. First part of // rdar://9254348

llvm-svn: 129171
2011-04-08 23:48:29 +00:00
Fariborz Jahanian c6078c87d1 Fixes a rewriter bug rewriting call to a byref
block pointer nested inside a block. // rdar:// 9204669

llvm-svn: 128747
2011-04-01 23:08:13 +00:00
Fariborz Jahanian 5bba75f1a7 ANother rewrite bug, rewriting a call of
__byref block. // rdar://9204669

llvm-svn: 128726
2011-04-01 19:19:28 +00:00
Fariborz Jahanian ff51d4e559 Fix couple of rewriter bugs related to rewriting a
__block block declaration. //rdar://9204669

llvm-svn: 128682
2011-03-31 22:49:32 +00:00
Fariborz Jahanian 8f4903397d Fix objc rewriting bug casting to qualified objective-c pointetr.
// rdar://9056351

llvm-svn: 126536
2011-02-26 01:31:36 +00:00
Fariborz Jahanian f2890fc93f Fix a rewriter bug involving call to property's
block. // rdar://9055596

llvm-svn: 126535
2011-02-26 00:33:41 +00:00
Fariborz Jahanian 40c5e1ada7 Teach objc-rewriter to pass -fobjc-exceptions along.
llvm-svn: 126497
2011-02-25 17:24:55 +00:00
Fariborz Jahanian 74405b02f9 Fix a rewrite bug. // rdar://9039342
llvm-svn: 126435
2011-02-24 21:29:21 +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
John McCall 8377967543 Warn about code that uses variables and functions with internal linkage
without defining them.  This should be an error, but I'm paranoid about
"uses" that end up not actually requiring a definition.  I'll revisit later.

Also, teach IR generation to not set internal linkage on variable
declarations, just for safety's sake.  Doing so produces an invalid module
if the variable is not ultimately defined.

Also, fix several places in the test suite where we were using internal
functions without definitions.

llvm-svn: 126016
2011-02-19 02:53:41 +00:00
Fariborz Jahanian 9cd649d376 Block rewriting bug. Don't take address of captured
byref variables again when passing them to inner blocks. 
// rdar://9006279

llvm-svn: 125690
2011-02-16 22:37:10 +00:00
Fariborz Jahanian ee504a0881 Fix an objective-c rewriter bug rewriting a __block
variable declaration of a struct declared type.
// rdar://8918702

llvm-svn: 124451
2011-01-27 23:18:15 +00:00
John McCall 4bb483629f Change the wording of the bad-decl-for-attribute warning and error
to make it clear that we're talking about the declarations and not the types.

llvm-svn: 124175
2011-01-25 03:51:08 +00:00
Fariborz Jahanian 83e7d5a90a Fix rewriter to match recent changes in property ref
AST.

llvm-svn: 120919
2010-12-04 21:22:13 +00:00
John McCall bd35f73b6b Apparently properties.m does not always fail; make it.
llvm-svn: 120894
2010-12-04 05:22:10 +00:00
John McCall 34376a68c4 Although we currently have explicit lvalue-to-rvalue conversions, they're
not actually frequently used, because ImpCastExprToType only creates a node
if the types differ.  So explicitly create an ICE in the lvalue-to-rvalue
conversion code in DefaultFunctionArrayLvalueConversion() as well as several
other new places, and consistently deal with the consequences throughout the
compiler.

In addition, introduce a new cast kind for loading an ObjCProperty l-value,
and make sure we emit those nodes whenever an ObjCProperty l-value appears
that's not on the LHS of an assignment operator.

This breaks a couple of rewriter tests, which I've x-failed until future
development occurs on the rewriter.

Ted Kremenek kindly contributed the analyzer workarounds in this patch.

llvm-svn: 120890
2010-12-04 03:47:34 +00:00
Fariborz Jahanian 086a24a2be Fixes a rewrite bug, rewriting nested property usage
inside blocks. Fixes //rdar: //8608293.

llvm-svn: 118425
2010-11-08 18:37:50 +00:00
Fariborz Jahanian 90d2e57ff7 Proper rewriting of block envokation with
qualified ObjC pointer types in its argument list.
// rdar: //8608902

llvm-svn: 118286
2010-11-05 18:34:46 +00:00
Fariborz Jahanian 733dde6035 Fixes a rewriting bug when type in a block argument type
is a objc qualified class type. // rdar: //8608902

llvm-svn: 118208
2010-11-03 23:50:34 +00:00
Fariborz Jahanian 147e1cbb49 Patch to rewrite objc qualified types which occur in
block pointer type arguments. Partial fix for 
// rdar: //8608902

llvm-svn: 118205
2010-11-03 23:29:24 +00:00
Fariborz Jahanian 7c299bc6fa Do not rewrite new accessor if user has defined accessors.
Fixes //rdar: // 8570020.

llvm-svn: 116882
2010-10-19 23:47:54 +00:00
Fariborz Jahanian 1cee0adea3 Fix a rewriting bug of rewriting properties declared in
protocols. // rdar: //8558702

llvm-svn: 116652
2010-10-16 00:29:27 +00:00
Fariborz Jahanian 9c07e1767d Rewrite bug fix rewriting a property assignment when
its RHS is an ivar. Fixes //rdar: //8541517.

llvm-svn: 116539
2010-10-14 23:31:39 +00:00
Fariborz Jahanian 163488ffbf When dealing with an assignment with LHS being a property reference
expression, the entire assignment tree is rewritten into a property
setter messaging. This includes rewriting the RHS. 
Do not attempt to rewrite RHS again. Never rewrite a rewritten text!
Fixes //rdar: //8527018.

llvm-svn: 116104
2010-10-08 21:12:22 +00:00
Fariborz Jahanian 4fc98f664b Start and end location of a property-dot syntax expression
must match start and end location of the expression
as expected by the rewriter client. Fixes // rdar: // 8520727

llvm-svn: 115934
2010-10-07 18:12:21 +00:00
Fariborz Jahanian fc8315f56a Fix a block rewriter bug where copy/dispose entries in
block descriptor for outer block was missing even though
the block was importing objects into its inner blocks.
//rdar://84995992

llvm-svn: 115644
2010-10-05 18:05:06 +00:00
Fariborz Jahanian 7bf13c49c7 Rewriting array element type of qualified-id.
Fixes rdra://8475819.

llvm-svn: 115201
2010-09-30 20:41:32 +00:00
Fariborz Jahanian aa0f2b3016 Fix rewriting of property declared in @protocol's.
Fixed //rdar://8472487.

llvm-svn: 114741
2010-09-24 18:36:58 +00:00
Chris Lattner 53fa04909c make clang print types as "const int *" instead of "int const*",
which is should have done from the beginning.  As usual, the most
fun with this sort of change is updating all the testcases.

llvm-svn: 113090
2010-09-05 00:04:01 +00:00
Fariborz Jahanian e6a4e3933d Initialize block's imported variable(s) in
block's synthesized constructor initalizer list.
Fixes radar 8240371.

llvm-svn: 109698
2010-07-28 23:27:30 +00:00
Fariborz Jahanian 34c85987fe Fix a rewriter bug which originates in SemaInit involving
Constructor Initialization which computes Source Location
differently now. Fixes radar 8213998.

llvm-svn: 109018
2010-07-21 17:36:39 +00:00
Chris Lattner 33919e7450 fix PR7280 by making the warning on code like this:
int test1() {
  return;
}

default to an error.

llvm-svn: 108108
2010-07-11 23:34:02 +00:00
Daniel Dunbar 8ab6c54ce2 Rewriter: Use the appropriate printing context instead of the default
constructed one -- this is necessary to ensure types get printed correctly.

llvm-svn: 107312
2010-06-30 19:16:53 +00:00
Fariborz Jahanian e33c116bdf Nasty rewriter bug which turns out to have an easy fix in
rewriting a c-style cast expression in statement printer.
Fixes radar 8143056.

llvm-svn: 107289
2010-06-30 16:31:08 +00:00
Fariborz Jahanian 19c6240713 Patch to rewrite block pointers as arguments to
methods. (Radar 7987817).

llvm-svn: 104608
2010-05-25 15:56:08 +00:00
Fariborz Jahanian 36680dd751 Fix a rewriting bug where a local static objective-c
pointer is copied into a block. Fixes radar 7924024.

llvm-svn: 104526
2010-05-24 18:32:56 +00:00
Fariborz Jahanian 427ee8b5f3 Fix an objective-c rewriter bug when pre-processed file's
class declaration's @end is not followed by a new-line.
(radar 7946975).

llvm-svn: 104512
2010-05-24 17:22:38 +00:00
Chris Lattner 8d269dc329 make the rewriter add a #ifndef around the #define of __attribute__.
Without it, there is no reason for a compiler that supports it to
emit the dead static globals that the rewriter labels attribute(used).

llvm-svn: 101149
2010-04-13 17:33:56 +00:00
Chris Lattner 198cb4df6e Instead of counting totally diagnostics, split the count into a count
of errors and warnings.  This allows us to emit something like this:

2 warnings and 1 error generated.

instead of:

3 diagnostics generated.

This also stops counting 'notes' because they are just follow-on information
about the previous diag, not a diagnostic in themselves.

llvm-svn: 100675
2010-04-07 18:47:42 +00:00
Fariborz Jahanian 3a106e7029 Add tentative support for accessing local variables with
external linkage (static, extern, etc.) in blocks in
rewriter. wip.

llvm-svn: 98265
2010-03-11 18:20:03 +00:00
Fariborz Jahanian a4a925febb Change the 'super' messaging API in the rewriter.
Fixes radar 7738452.

llvm-svn: 98190
2010-03-10 21:17:41 +00:00
Fariborz Jahanian 97bb418575 Make rewritten source compiled with clang++.
llvm-svn: 97762
2010-03-04 23:13:29 +00:00
Fariborz Jahanian 7103835d79 Make rewritten source compiled with clang++ for correctness.
llvm-svn: 97761
2010-03-04 23:03:49 +00:00
Fariborz Jahanian 3db51d80ec Change test to compile rewritten test with clang++.
llvm-svn: 97756
2010-03-04 21:57:21 +00:00
Fariborz Jahanian 8bb35c4d7c Fixes a bug whereby static const block var has static
moved incorrectly. (radar 7714443).

llvm-svn: 97734
2010-03-04 18:54:29 +00:00
Fariborz Jahanian f4609d431f More rewriter of nested blocks fun stuff.
Radar 7696893.

llvm-svn: 97520
2010-03-01 23:36:21 +00:00