Commit Graph

208 Commits

Author SHA1 Message Date
Matthijs Kooijman 1f7fac0da4 Add newline at the end of file, to silence compiler warning.
llvm-svn: 57818
2008-10-20 08:12:48 +00:00
Chris Lattner f6a3bda65e make the -rewrite-test a bit more interesting: it now
wraps comments in <i> tags.  Extend rewrite tokens to support
this minimal functionality.

llvm-svn: 57409
2008-10-12 06:09:52 +00:00
Chris Lattner b6aa53b7de start implementing a token rewriter. At this point, it just reads in a file
and lets a client iterate over it. 

llvm-svn: 57407
2008-10-12 05:44:03 +00:00
Chris Lattner 1782da2f84 Add a new -rewrite-test option, which is basically a
playground to experiment with some new rewriter approaches. For now
it is probably the most complex version of 'cat' ever invented.

llvm-svn: 57406
2008-10-12 05:29:20 +00:00
Steve Naroff a8f0d12e81 Rename a file and update the Xcode project.
llvm-svn: 49693
2008-04-14 22:05:54 +00:00
Steve Naroff 1dc53ef494 Rename RewriteTest->RewriteObjC.
llvm-svn: 49692
2008-04-14 22:03:09 +00:00
Ted Kremenek d61ed3b6cb Use isFromMainFile instead of comparing FileIDs directly.
llvm-svn: 49687
2008-04-14 21:24:13 +00:00
Chris Lattner 4fdfbf7b89 silence some warnings when assertions are disabled.
llvm-svn: 49372
2008-04-08 05:52:18 +00:00
Chris Lattner 0a5ff0d34a This patch contains these changes:
-Renamed ContextDecl -> DeclContext
-Removed DeclContext pointer from FieldDecl
-EnumDecl inherits from DeclContext, instead of TagDecl

Patch by Argiris Kirtzidis!

llvm-svn: 49261
2008-04-06 04:47:34 +00:00
Steve Naroff 4dbab8a49d Avoid implicitly including any header files (requested by ckane).
llvm-svn: 49241
2008-04-04 22:58:22 +00:00
Steve Naroff af91b9ae13 Rewrite @package (an ObjC 2.0 idiom).
llvm-svn: 49238
2008-04-04 22:34:24 +00:00
Steve Naroff eae91700de Fix MS-specific bug in RewriteTest::RewriteObjCMethodDecl().
llvm-svn: 49237
2008-04-04 22:23:44 +00:00
Chris Lattner c5ffed4a66 Introduce ContextDecl, patch by Argiris Kirtzidis!
-Added ContextDecl (no TranslationUnitDecl)
-ScopedDecl class has a ContextDecl member
-FieldDecl class has a ContextDecl member, so that a Field or a ObjCIvar can be traced back to their RecordDecl/ObjCInterfaceDecl easily
-FunctionDecl, ObjCMethodDecl, TagDecl, ObjCInterfaceDecl inherit from ContextDecl. With TagDecl as ContextDecl, enum constants have a EnumDecl as their context.
-Moved Decl class to a "DeclBase.h" along with ContextDecl class
-CurContext is handled by Sema

llvm-svn: 49208
2008-04-04 06:12:32 +00:00
Steve Naroff f9e7c90129 Only have the rewriter produce a file when there are no errors.
llvm-svn: 48926
2008-03-28 22:26:09 +00:00
Steve Naroff 60a9ef67e2 Add some of Ted's recent work to the VC++ project file.
Fix a couple bozo bugs in the rewriter.

llvm-svn: 48903
2008-03-27 22:59:54 +00:00
Steve Naroff 00a317694b Collect all the preamble code and don't insert it until the end.
llvm-svn: 48899
2008-03-27 22:29:16 +00:00
Steve Naroff 65838bb2d5 Add a couple files to VC++ project and cleanup an "#if 0".
llvm-svn: 48748
2008-03-24 22:03:25 +00:00
Chris Lattner 97d496c182 Teach the rewriter how to respect the -o option.
llvm-svn: 48669
2008-03-22 00:08:40 +00:00
Steve Naroff 327f0f4c3a Fix <rdar://problem/5716940> rewriter generates invalid C code when no selector found.
llvm-svn: 48479
2008-03-18 02:02:04 +00:00
Steve Naroff 034bcb5bfa Wrap up __NSConstantStringImpl (the replacement for __builtin___CFStringMakeConstantString).
llvm-svn: 48477
2008-03-18 01:47:18 +00:00
Chris Lattner 41eec3d097 make property addition work list all other "add" methods. Do
the allocation in the class, not in sema.

llvm-svn: 48433
2008-03-16 21:23:50 +00:00
Chris Lattner 8d1c04f53a Convert more counts to be zero based instead of -1 based, make them unsigned.
llvm-svn: 48429
2008-03-16 21:08:55 +00:00
Chris Lattner acc04a9261 minor cleanups, make getNumInstanceMethods always return unsigned.
llvm-svn: 48423
2008-03-16 20:19:15 +00:00
Chris Lattner 011b0f5c5a Make the parameter count of ObjCMethodDecl unsigned, you
can't have negative arguments.

llvm-svn: 48407
2008-03-16 01:07:14 +00:00
Chris Lattner ee1284a6e2 switch the rest of the C decl classes to do their
allocation through ASTContext.

llvm-svn: 48403
2008-03-16 00:16:02 +00:00
Chris Lattner 96c460d142 move the ASTContext argument to be first in the argument list of
all Create methods.

llvm-svn: 48398
2008-03-15 21:32:50 +00:00
Chris Lattner 5072bae709 Switch over functiondecl. This makes it obvious that the ASTContext
argument to Create should be first, not last.

llvm-svn: 48397
2008-03-15 21:24:04 +00:00
Chris Lattner 4b08ca8f2e switch the VarDecl allocation model to go through ASTContext.
llvm-svn: 48396
2008-03-15 21:10:16 +00:00
Chris Lattner a7b3287760 start switching decls over to using an allocator controlled by ASTContext.
Right now only some ctors are switched over.  I need to switch them all
over so I can change the dtor over.

This lets us experiment with region allocation and other things in the 
future.

llvm-svn: 48390
2008-03-15 06:12:44 +00:00
Steve Naroff dad80ba9b1 Link against the correct ObjC string class (__CFConstantStringClassReference) and fix length computation (removing a FIXME).
llvm-svn: 48384
2008-03-15 01:36:04 +00:00
Steve Naroff ce8e886731 Remove ObjC rewriter dependency on GCC's __builtin___CFStringMakeConstantString.
llvm-svn: 48383
2008-03-15 00:55:56 +00:00
Steve Naroff 35cb7960e3 Two fixes to RewriteTest::RewriteObjCIvarRefExpr():
- For explicit ivar refers, make sure the cast is propagated to the AST.
- Don't free the base (since it is still in use).
This fixes the recent regression to test/Rewriter/objc-ivar-receiver-1.m.

llvm-svn: 48309
2008-03-12 23:15:19 +00:00
Steve Naroff ffb5f9ad93 Minor aesthetic improvement (after I reviewed my last commit).
llvm-svn: 48304
2008-03-12 21:22:52 +00:00
Steve Naroff 9f33bd2c34 Avoid using the "unnamed struct field" extension (enabled with -fms-extensions). This feature/extension silently does the wrong thing in g++. As far as I can tell, g++ simply throws the field away entirely (note that it works fine with gcc). Since I am now always casting the object (for other reasons), accessing protected/public fields simply requires the cast refer to the defining class. This solution is simpler all around (thanks to Chris for suggesting it).
llvm-svn: 48302
2008-03-12 21:09:20 +00:00
Steve Naroff b327e49047 Use the "used" attribute. Without it, g++ removes all the meta-data:-( This doesn't happen when compiling straight C code.
llvm-svn: 48287
2008-03-12 17:18:30 +00:00
Steve Naroff 5d5efca405 -Add missing visitor for ObjCIvarRefExpr.
-Wrap objc runtime calls with "extern "C"" (for now).

llvm-svn: 48284
2008-03-12 13:19:12 +00:00
Steve Naroff 251084d03e Remove more dependencies on C "flexible array member" idiom (when generating meta-data).
llvm-svn: 48271
2008-03-12 01:06:30 +00:00
Steve Naroff dc5b6b2e5d Make ivar rewrite C++ friendly (since C++ forces a unified namespace for typedefs/structures). The previous version of the rewriter generated both a type def and structure def for each class (which doesn't fly in C++).
llvm-svn: 48266
2008-03-12 00:25:36 +00:00
Steve Naroff 0b844f053f Make "super" rewrite for class methods C++ friendly (follow-up from last commit).
llvm-svn: 48235
2008-03-11 18:14:26 +00:00
Steve Naroff 17978c4dcb Make "super" rewrite C++ friendly (since it doesn't support Compound Literals).
llvm-svn: 48230
2008-03-11 17:37:02 +00:00
Steve Naroff c5b9cc70ce Generate meta-data in a C++ compatible way (remove 2 dependencies on C "flexible array member" idiom and perform some extra casts).
llvm-svn: 48202
2008-03-11 00:12:29 +00:00
Steve Naroff 14a0746b13 Missed a couple "_IMPL" suffixes.
llvm-svn: 48191
2008-03-10 23:33:22 +00:00
Steve Naroff a1e115ee57 Fix dangling pointer and give the implementation struct for a class a unique name.
llvm-svn: 48190
2008-03-10 23:16:54 +00:00
Steve Naroff 945a3b145a Pass LangOptions to RewriteTest().
llvm-svn: 48172
2008-03-10 20:43:59 +00:00
Chris Lattner 37e0587839 remove the source location arguments to various target query methods.
llvm-svn: 47954
2008-03-05 18:54:05 +00:00
Eli Friedman 1242fff6ec Make sure to propagate qualifiers through the member operator.
llvm-svn: 46830
2008-02-06 22:48:16 +00:00
Steve Naroff e6b7ffd073 Minor API cleanup...
llvm-svn: 46649
2008-02-01 22:08:12 +00:00
Steve Naroff d9dc63f2c5 Remove temporary workaround (thanks to Ted for fixing ObjCAtCatchStmt so quickly:-).
llvm-svn: 46648
2008-02-01 21:51:39 +00:00
Steve Naroff edb5bc6f09 Fix two rewriter bugs with @catch.
- Support @catch(...), rather than crash:-)
- Make sure all catch bodies get rewritten. This "fix" is really a workaround until the iterator for the "try" AST is fixed. Will fix this in a separate commit.

llvm-svn: 46644
2008-02-01 20:02:07 +00:00
Chris Lattner 9cc55f5b1f add some helper methods for removing and replacing text, this makes the
rewriter more robust.

llvm-svn: 46622
2008-01-31 19:51:04 +00:00