Chris Lattner
e9c810c87c
pass diagnostics into the rewrite test client.
...
llvm-svn: 44468
2007-11-30 22:25:36 +00:00
Fariborz Jahanian
96502afb6f
Fixed a rewrite bug in class synthesis (which I first thought was a rewrite API bug).
...
llvm-svn: 44335
2007-11-26 20:59:57 +00:00
Fariborz Jahanian
a883d6ed89
Patch to fix a regression caused by recent rewrite changes.
...
A potential API bug in ReplaceText pending (A FIXME is added).
llvm-svn: 44333
2007-11-26 19:52:57 +00:00
Steve Naroff
c8fcbe09d0
No need to forward declare definition of objc_super...
...
llvm-svn: 44173
2007-11-15 17:06:21 +00:00
Steve Naroff
d8ea1ac576
Implement support for variadic methods (work in progress).
...
llvm-svn: 44171
2007-11-15 12:35:21 +00:00
Steve Naroff
05caa48fb4
Extend RewriteTest::RewriteObjCIvarRefExpr() to cope with static typing (when using -> on a type which corresponds to the implementation type).
...
llvm-svn: 44170
2007-11-15 11:33:00 +00:00
Steve Naroff
44864e48bd
Tweak funky cast to accommodate messaging 'super'. This removes any spurious warnings.
...
llvm-svn: 44169
2007-11-15 10:43:57 +00:00
Steve Naroff
7fa2f040f3
Rewrite for messaging 'super'.
...
The code gen. results in some spurious warnings...a cast is forthcoming.
llvm-svn: 44168
2007-11-15 10:28:18 +00:00
Steve Naroff
f60782b8c9
- Implement ivar rewrite (patch by Fariborz).
...
- RewriteMessageExpr()...make implicit casts explicit with synthesizing call (removing warnings when calling objc_msgSend()).
llvm-svn: 44156
2007-11-15 02:58:25 +00:00
Steve Naroff
909d666681
Refinement to previous commit. Always cast the first argument to "id"...no need to special case self.
...
llvm-svn: 44149
2007-11-15 00:00:21 +00:00
Steve Naroff
e7f181986a
Cast implicit "self" argument to "id". This removes all warnings associated with implicit references to self. It doesn't yet deal withexplicit references to self...
...
llvm-svn: 44148
2007-11-14 23:54:14 +00:00
Steve Naroff
03f2767368
Always generate a typedef for @class . The typedef removal logic that I'm removing only made sense when we were operating on preprocess files without typedef guards. Now that we have guards, it is incorrect to ever remove one (since it may increase the likelihood that the rewritten header can't be included stand alone).
...
llvm-svn: 44145
2007-11-14 23:02:56 +00:00
Chris Lattner
174a825f01
Fix a rewriter bug that steve noticed. Don't skip arbitrary things
...
between an @ and a p, just skip whitespace.
llvm-svn: 44144
2007-11-14 22:57:51 +00:00
Fariborz Jahanian
c6225532c3
Patch to comment out use of protocol qualifiers when rewriting ivars.
...
llvm-svn: 44142
2007-11-14 22:26:25 +00:00
Steve Naroff
dde78986fb
Fairly major surgery to RewriteTest::SynthesizeObjcInternalStruct().
...
This allows us to handle funky stuff like...
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
@interface NSLayoutManager : NSObject <NSCoding, NSGlyphStorage> {
#else /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 */
@interface NSLayoutManager : NSObject <NSCoding> {
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 */
...which now rewrites to...
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
#ifndef _REWRITER_typedef_NSLayoutManager
#define _REWRITER_typedef_NSLayoutManager
typedef struct objc_object NSLayoutManager;
#endif
struct NSLayoutManager {
struct NSObject _NSObject;
#else /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 */
// @interface NSLayoutManager : NSObject <NSCoding> {
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 */
llvm-svn: 44129
2007-11-14 19:25:57 +00:00
Fariborz Jahanian
794793ec1c
Removed unused variabel.
...
llvm-svn: 44123
2007-11-14 17:35:46 +00:00
Steve Naroff
a509f04034
Fix yesterday's regression with rewriting @optional/@required.
...
llvm-svn: 44119
2007-11-14 15:03:57 +00:00
Steve Naroff
58ed6c04f2
Rewrite methods that span multiple lines.
...
llvm-svn: 44118
2007-11-14 14:34:23 +00:00
Steve Naroff
c17b056427
Comment out recent regression r44096.
...
llvm-svn: 44098
2007-11-14 03:37:28 +00:00
Fariborz Jahanian
fe38ba24af
Rewrite @optional/@required directives used inside protocol definitions.
...
llvm-svn: 44096
2007-11-14 01:37:46 +00:00
Fariborz Jahanian
da6165c3dc
Rewrite of forward protocol declaration.
...
llvm-svn: 44095
2007-11-14 00:42:16 +00:00
Steve Naroff
7b8fa4746a
Rewrite method definition bodies. Also renamed a method to distinguish between method declarations and definitions.
...
llvm-svn: 44080
2007-11-13 23:01:27 +00:00
Fariborz Jahanian
989e03989b
Fixed a rewrite of metadata bug when category implementation has no matching interface.
...
llvm-svn: 44072
2007-11-13 22:09:49 +00:00
Fariborz Jahanian
5633835d17
Populate metadata with adrress of method code.
...
llvm-svn: 44066
2007-11-13 21:02:00 +00:00
Fariborz Jahanian
c54d8462fb
Rewrite of method definitions in categories.
...
llvm-svn: 44062
2007-11-13 20:04:28 +00:00
Fariborz Jahanian
98ba6cde3d
Order of methods are OK and generated .c file can be compiled.
...
llvm-svn: 44060
2007-11-13 19:21:13 +00:00
Fariborz Jahanian
1e5f64e2ea
First patch in rewrie of method definitions. This is work in progress.
...
llvm-svn: 44055
2007-11-13 18:44:14 +00:00
Steve Naroff
e3d1ab29da
- Minor cleanup to yesterday's changes to Sema::ObjcActOnStartOfMethodDef();
...
- Add Sema::CurMethodDecl, in preparation for adding ObjcIvarRefExpr.
- Add ObjcInterfaceDecl::lookupInstanceVariable(), in prep for adding ivars.
- A couple renames in ObjcInterfaceDecl, while I was in the vicinity:-)
llvm-svn: 44015
2007-11-12 13:56:41 +00:00
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
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
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