Commit Graph

323 Commits

Author SHA1 Message Date
Steve Naroff cac26f4f5f This is the last 5% of the solution to teaching Sema::ActOnInstanceMessage() about private methods (r43989).
While the diff is large, the idea is very simple. When we parse method definitions (in an @implementation), we need to add them incrementally (rather than wait until the @end).

Other details...

- Renamed Sema::ActOnAddMethodsToObjcDecl() to Sema::ActOnAtEnd(). The methods are now optional arguments.
- Removed Parser::AllImplMethods (a nice cleanup).
- Added location info to ObjcImplementationDecl (since we will need it very soon:-)
- Modified message.m test to no longer allow the bogus diagnostic.

llvm-svn: 43995
2007-11-11 17:19:15 +00:00
Fariborz Jahanian 16e3123071 pretty priting for method definitions.
llvm-svn: 43986
2007-11-10 20:59:13 +00:00
Ted Kremenek 11d700bfba Modifed the test serialization driver to...
(1) serialize out top-level decls BEFORE serializing out translation unit
structures like ASTContext.

(2) deserialize out translation unit structures like ASTContext before
top-level decls by first skipping the decls in the bitstream, deserializing
ASTContext and friends, and then jumping back to the bitstream block with the
decls and then deserializing them.

Change (1) allows us to utilize the pointer-tracking system in the Serializer
to only serialize out metadata that is actually referenced by the ASTS.

Change (2) allows us to deserialize the metadata first as before, which
signficantly reduces the amount of pointer backpatching the deserializer
would have to do if the decls were deserialized first.

llvm-svn: 43974
2007-11-10 02:07:12 +00:00
Steve Naroff 2011338446 Rewrite global variable initializers.
llvm-svn: 43947
2007-11-09 15:20:18 +00:00
Steve Naroff 1b232132ad - add typedef guards.
- tweak scanForProtocolRefs heuristic.
- disable RewriteInclude() for now.

llvm-svn: 43942
2007-11-09 12:50:28 +00:00
Steve Naroff 265a6b9693 Rewrite RewriteObjCStringLiteral(). This version is simpler (and unlike the previous one, works:-)
llvm-svn: 43890
2007-11-08 14:30:50 +00:00
Chris Lattner dc0cfc9fe3 use insert instead of replacing 0 bytes with text :)
llvm-svn: 43882
2007-11-08 04:41:51 +00:00
Chris Lattner 9fd5890e52 use std::copy instead of memcpy for abstraction.
Disable rewrite-tabs.  This speeds up processing of the commentified huge
crazy testcase steve gave me from 20s to 6.6s in a release build.

llvm-svn: 43880
2007-11-08 04:27:23 +00:00
Steve Naroff 1601858de5 Finishing touches on code generation for @try and friends.
- declare functions we use.
- cast arguments to objc_exception_match().
- don't take the & of _stack.buf.

llvm-svn: 43831
2007-11-07 18:43:40 +00:00
Fariborz Jahanian 1299a92327 Emit objective-c's meta-data at the end of rewriting to stdout.
llvm-svn: 43830
2007-11-07 18:40:28 +00:00
Steve Naroff a733c7ffe4 Implement rewrite for @throw.
llvm-svn: 43820
2007-11-07 15:32:26 +00:00
Steve Naroff bf478ece48 Rewrite ObjC @try/@catch/@finally. Some minor tweaks to the AST nodes...
Still need to rewrite @throw (and do more testing)...

llvm-svn: 43803
2007-11-07 04:08:17 +00:00
Fariborz Jahanian e8a3016ac7 Rewrite for properties.
llvm-svn: 43791
2007-11-07 00:09:37 +00:00
Ted Kremenek fa2bf434cc Fixed typo in the name of "ReadPreamble".
llvm-svn: 43790
2007-11-06 23:52:19 +00:00
Ted Kremenek 93d446f535 Bug fix: inverted test condition to see if a serialized AST-bitcode
file had the correct preamble.

llvm-svn: 43785
2007-11-06 22:23:03 +00:00
Fariborz Jahanian f76f2b0c1c Patch for objc2's property ASTs, as well as pretty-priting the ASTs.
llvm-svn: 43778
2007-11-06 22:01:00 +00:00
Ted Kremenek 3a68de993a Revampled Serialization Tester to serialize and deserialize out an entire ASTContext and top-level decls.
llvm-svn: 43773
2007-11-06 19:50:53 +00:00
Ted Kremenek 15f50ba755 In driver code implemented serialization of ASTContext. Working on serialization of simple ASTs.
llvm-svn: 43738
2007-11-05 21:39:35 +00:00
Fariborz Jahanian 63ac80e76a Misc. fixes. 1) Resurrect meta-data generation turned off by a previous patch.
2) Fixed a regression in meta-data generation caused by removal of '_interface' prefix from synthesize class name.
3) Added stubs for @try/@catch/@finally statements.

llvm-svn: 43716
2007-11-05 17:47:33 +00:00
Steve Naroff bd72289baa Declare objc_selector outside the prototype for objc_msgSend(), removing a silly warning.
llvm-svn: 43706
2007-11-05 14:55:35 +00:00
Steve Naroff e4f9b23458 Rewrite @selector(sel).
llvm-svn: 43705
2007-11-05 14:50:49 +00:00
Steve Naroff 98eb8d1275 - change the synthesized typedef (for classes) to be of type "objc_object".
- fix a couple bugs in RewriteObjCStringLiteral.
- convert "Class" -> "id" in RewriteMessageExpr.

llvm-svn: 43704
2007-11-05 14:36:37 +00:00
Steve Naroff 3865e4d8b4 Remove HandleObjcMetaDataEmission(), I inadvertantly resurrected it.
llvm-svn: 43690
2007-11-05 00:25:00 +00:00
Steve Naroff f36987c79b Two additions...
- Synthesize the funky cast for objc_msgSend(). For the basic case, it looks like...

((id (*)(id, SEL))(void *)objc_msgSend)(obj, sel);

The "void *" cast is needed to workaround a GCC "bandaid" (Chris says it has something to do with the inliner). Without the extra "void *" cast, we get spurious warnings/notes that look like...

xx.m:17: warning: function called through a non-compatible type
xx.m:17: note: if this code is reached, the program will abort

- Add prototypes for the ObjC functions we call, objc_msgSend/objc_getClass for now (don't depend on them being included).

llvm-svn: 43685
2007-11-04 22:37:50 +00:00
Steve Naroff a397efd915 Implement rewrite rules for ObjC string constants.
llvm-svn: 43665
2007-11-03 11:27:19 +00:00
Chris Lattner 376cdaf50b Fix ownership model of ParseAST to allow the dtor of
ASTConsumer to process the AST before it is destroyed.
This allows elimination of HandleObjcMetaDataEmission.

llvm-svn: 43659
2007-11-03 06:24:16 +00:00
Steve Naroff 63006473d5 - Remove _interface_ prefix for the synthesized tag names.
- Also removed a tab from the generated struct (minor).

llvm-svn: 43616
2007-11-01 17:12:31 +00:00
Steve Naroff 50d4205ff9 Implement rewrite rule for commenting out protocol references. For example:
extern id /*<NSObject>*/ NSAllocateObject(Class aClass, unsigned extraBytes, NSZone *zone);

extern void NSDeallocateObject(id /*<NSObject>*/object);

extern id /*<NSObject>*/ NSCopyObject(id /*<NSObject>*/object, unsigned extraBytes, NSZone *zone);

llvm-svn: 43612
2007-11-01 13:24:47 +00:00
Steve Naroff 2f55b98725 Tweak RewriteInterfaceDecl() to generate a typedef (if one hasn't already been generated).
llvm-svn: 43600
2007-11-01 03:35:41 +00:00
Fariborz Jahanian 7a9c47480d 1) More additions for objective-c's qualifier type.
2) Fixed a test failure (which should have failed all along!).

llvm-svn: 43589
2007-10-31 23:53:01 +00:00
Fariborz Jahanian c3cda76362 Fixed a bug exposed by fixing the assert in previous patch (one of the tests asserted).
llvm-svn: 43586
2007-10-31 23:08:24 +00:00
Fariborz Jahanian aa9a95ca4f Changed direction of assert. Added more comments.
llvm-svn: 43585
2007-10-31 22:57:04 +00:00
Steve Naroff 9c4fdddd0c Fix two rewriter bugs:
- For @class, don't generate multiple typedefs.
- Handle the following edge case interface...

@interface NSMiddleSpecifier : NSObject {}

@end

...which was incorrectly being rewritten to...

struct _interface_NSMiddleSpecifier {
        struct _interface_NSObject _NSObject;
};
{}

llvm-svn: 43582
2007-10-31 22:11:35 +00:00
Steve Naroff aaba027717 Implement ObjC built-in types in MinimalAction.
This fixes the recent regression with selector-1.m and -parse-noop.

llvm-svn: 43575
2007-10-31 20:55:39 +00:00
Devang Patel 75ef2f0b45 Take 2.
Make target info available to clang code generator.  This is far from complete but this helps clang codegen module make progress.

At the moment target triplet and target description strings are hard coded in clang::TargetInfo

llvm-svn: 43572
2007-10-31 20:01:01 +00:00
Fariborz Jahanian aff228dfc7 Rewriteing of ivars changed to just copy directly from the source.
llvm-svn: 43560
2007-10-31 17:29:28 +00:00
Steve Naroff ac0216385f Checking in some code that is still under construction.
I need to (finally) change the way Class/id/SEL/IMP are built-in...the current approach of doing it in the preprocessor is "broken". The other problem is Sema::GetObjcIdType/GetObjcSelType/GetObjcClassType, the hooks that initialize ASTContext lazily. These built-in types need to be done up front...

llvm-svn: 43557
2007-10-31 16:03:04 +00:00
Chris Lattner 5087e267c2 temporarily revert devang's patch to link in the llvm codegen etc.
llvm-svn: 43544
2007-10-31 04:53:03 +00:00
Steve Naroff 37e011ce43 Add some plumbing to help cope with rewriting "id<p>", "Class<p>*".
llvm-svn: 43543
2007-10-31 04:38:33 +00:00
Devang Patel 46c7003052 Make target info available to clang code generator.
This is far from complete but this helps clang codegen module
make progress.

llvm-svn: 43536
2007-10-31 00:59:29 +00:00
Steve Naroff 5cdcd9b61c Stop pre-defining objc_msgSend/objc_getClass in the preprocessor. Instead, I generate these declaration on the fly when rewriting a message expression.
llvm-svn: 43529
2007-10-30 23:14:51 +00:00
Steve Naroff f921385f40 Rewrite protocols.
llvm-svn: 43503
2007-10-30 16:42:30 +00:00
Steve Naroff 5448cf6d61 - Add location info to category/protocol AST's
- Rewrite categories.

llvm-svn: 43501
2007-10-30 13:30:57 +00:00
Steve Naroff 4cd61acc33 Remove a couple FIXME's for rewriting ObjC interfaces (which are now being rewritten properly).
llvm-svn: 43494
2007-10-30 03:43:13 +00:00
Steve Naroff c54840433f More support for rewriting ObjC intefaces. Still some edge cases to handle...
llvm-svn: 43493
2007-10-30 02:23:23 +00:00
Fariborz Jahanian 797f24cd7e Encoding for objectiive-c methods.
llvm-svn: 43481
2007-10-29 22:57:28 +00:00
Fariborz Jahanian bc2759372b Do the encoding of ivar types in the ivar metadata.
llvm-svn: 43454
2007-10-29 17:16:25 +00:00
Anders Carlsson d849982e84 Add (partial) support for @encode.
llvm-svn: 43439
2007-10-29 05:01:08 +00:00
Fariborz Jahanian 801b63525d Path to synthesize 'instance' size field of _objc_class metadata.
llvm-svn: 43409
2007-10-26 23:09:28 +00:00
Steve Naroff 161a92b976 Start rewriting ObjC interfaces. As a start, we comment out all the methods. This involved refining how the parser/AST passes/manages SourceLocations for ObjcMethodDecl's.
llvm-svn: 43404
2007-10-26 20:53:56 +00:00