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  
				
					
						
							
							
								 
						
							
								2e0d2600a2 
								
							 
						 
						
							
							
								
								Make rewriter::inserttext return a bool to indicate if it failed.  
							
							... 
							
							
							
							Add a RewriteTest::ReplaceStmt method to factor the 'checking for
rewrite failed + emitting diagnostic if so' code.
llvm-svn: 46619 
							
						 
						
							2008-01-31 19:37:57 +00:00  
				
					
						
							
							
								 
						
							
								2dd606839d 
								
							 
						 
						
							
							
								
								add some assertions so that the rewriter dies violently with a useful  
							
							... 
							
							
							
							error instead of subtly with a mysterious one.
llvm-svn: 46287 
							
						 
						
							2008-01-23 23:37:15 +00:00  
				
					
						
							
							
								 
						
							
								5b12ab8c93 
								
							 
						 
						
							
							
								
								Don't attribute in file headers anymore.  See llvmdev for the  
							
							... 
							
							
							
							discussion of this change.
llvm-svn: 45410 
							
						 
						
							2007-12-29 19:59:25 +00:00  
				
					
						
							
							
								 
						
							
								f546408406 
								
							 
						 
						
							
							
								
								remove some temporary code.  
							
							... 
							
							
							
							llvm-svn: 43906 
							
						 
						
							2007-11-08 20:53:07 +00:00  
				
					
						
							
							
								 
						
							
								b74f6e82e4 
								
							 
						 
						
							
							
								
								add a getAtOffset() member to simplify some code.  
							
							... 
							
							
							
							llvm-svn: 43905 
							
						 
						
							2007-11-08 20:51:02 +00:00  
				
					
						
							
							
								 
						
							
								e90ce8def3 
								
							 
						 
						
							
							
								
								Add a new RewriteRope data structure which is a smarter way to represent the text  
							
							... 
							
							
							
							backing a rewrite buffer than using an std::vector<char>.  This class was hacked
together very quickly and needs to be cleaned up, but it seems to work.  It speeds
up rewriting a a 7M file from 6.43s to 0.24s on my machine.  The impl could also
be made to be a lot more algorithmically sound.
This produces identical output to using vector on this testcase, if it causes a
problems or bugs are encountered, it can be disabled by changing the 
RewriteBuffer::Buffer typedef back.
llvm-svn: 43884 
							
						 
						
							2007-11-08 07:35:14 +00:00  
				
					
						
							
							
								 
						
							
								edebdb5b29 
								
							 
						 
						
							
							
								
								minor cleanups  
							
							... 
							
							
							
							llvm-svn: 43881 
							
						 
						
							2007-11-08 04:41:04 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								4573cc708a 
								
							 
						 
						
							
							
								
								Fix a rewriter bug that fariborz hit, when an @interface was the very very very  
							
							... 
							
							
							
							first thing in the file.
The trick is that text replacement should go after the insert point, 
not before it, because it will be replacing text after the point, not before 
it.
llvm-svn: 43879 
							
						 
						
							2007-11-08 04:09:59 +00:00  
				
					
						
							
							
								 
						
							
								bcce2f8d54 
								
							 
						 
						
							
							
								
								Fix an inverted conditional,  
							
							... 
							
							
							
							--chris
llvm-svn: 43789 
							
						 
						
							2007-11-06 23:06:16 +00:00  
				
					
						
							
							
								 
						
							
								0b271eb7af 
								
							 
						 
						
							
							
								
								Expose InsertText, fixing an oversight.  
							
							... 
							
							
							
							llvm-svn: 43643 
							
						 
						
							2007-11-02 17:26:47 +00:00  
				
					
						
							
							
								 
						
							
								88710ff5b8 
								
							 
						 
						
							
							
								
								simplify change.  
							
							... 
							
							
							
							llvm-svn: 43348 
							
						 
						
							2007-10-25 17:18:59 +00:00  
				
					
						
							
							
								 
						
							
								94a41ff6c1 
								
							 
						 
						
							
							
								
								Fix a bug steve noticed when handling nested rewrites.  We now turn this:  
							
							... 
							
							
							
							NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
into:
    NSAutoreleasePool * pool = objc_msgSend(objc_msgSend(objc_getClass("NSAutoreleasePool"), sel_getUid("alloc")), sel_getUid("init"));
instead of:
    NSAutoreleasePool * pool = objc_msgSend(objc_msgSend(objc_getClass("NSAutoreleasePool"), sel_getUid("alloc")), sel_getUid("init"))utoreleasePool"), sel_getUid("alloc")) init];
llvm-svn: 43347 
							
						 
						
							2007-10-25 17:17:34 +00:00  
				
					
						
							
							
								 
						
							
								c6d91c0f6d 
								
							 
						 
						
							
							
								
								Add new API to rewrite one stmt/expr with another.  
							
							... 
							
							
							
							llvm-svn: 43101 
							
						 
						
							2007-10-17 22:35:30 +00:00  
				
					
						
							
							
								 
						
							
								42ebe5c1e6 
								
							 
						 
						
							
							
								
								The size returned by Rewriter::getRangeSize should include  
							
							... 
							
							
							
							the size of the last token.
llvm-svn: 43092 
							
						 
						
							2007-10-17 21:23:07 +00:00  
				
					
						
							
							
								 
						
							
								37390bed4d 
								
							 
						 
						
							
							
								
								Fix location processing of @encode: the range should include the @ sign.  
							
							... 
							
							
							
							@selector probably gets this wrong also.
llvm-svn: 43048 
							
						 
						
							2007-10-16 22:51:17 +00:00  
				
					
						
							
							
								 
						
							
								a7c19feca2 
								
							 
						 
						
							
							
								
								Add a new Rewriter::getRangeSize method.  
							
							... 
							
							
							
							Rename SourceRange::Begin()/End() to getBegin()/getEnd() for
consistency with other code.
Start building the rewriter towards handling @encode.
llvm-svn: 43047 
							
						 
						
							2007-10-16 22:36:42 +00:00  
				
					
						
							
							
								 
						
							
								0bd1c97293 
								
							 
						 
						
							
							
								
								Push the rewriter forward a bit more.  Now it rewrites  
							
							... 
							
							
							
							#import to #include's as a test.
llvm-svn: 43041 
							
						 
						
							2007-10-16 21:07:07 +00:00  
				
					
						
							
							
								 
						
							
								6a91cc03ad 
								
							 
						 
						
							
							
								
								haha, my devious plot is complete:  
							
							... 
							
							
							
							$ clang rewrite.c -rewrite-test
prints:
int foo() {
        b:      foo();
f:      foo();
    foo();
}
for:
int foo() {
	b:	foo();
f:	foo();
    foo();
}
amazing.
llvm-svn: 42944 
							
						 
						
							2007-10-13 00:46:29 +00:00  
				
					
						
							
							
								 
						
							
								2a8ab05f5f 
								
							 
						 
						
							
							
								
								With this I can now insert stuff before tabs, woo.  
							
							... 
							
							
							
							llvm-svn: 42942 
							
						 
						
							2007-10-13 00:21:23 +00:00  
				
					
						
							
							
								 
						
							
								58bad341bc 
								
							 
						 
						
							
							
								
								Woo, tab deletion now works.  Next lets see if we can  
							
							... 
							
							
							
							insert stuff.
llvm-svn: 42941 
							
						 
						
							2007-10-13 00:17:04 +00:00  
				
					
						
							
							
								 
						
							
								2fcf1b83c1 
								
							 
						 
						
							
							
								
								another step forward in rewriter stuff.  This still has  
							
							... 
							
							
							
							some incredibly subtle details that I'm working on getting
right.
llvm-svn: 42940 
							
						 
						
							2007-10-13 00:11:23 +00:00  
				
					
						
							
							
								 
						
							
								16a0de468f 
								
							 
						 
						
							
							
								
								Push the rewriting APIs along.  Build a trivial client that replaces tabs  
							
							... 
							
							
							
							with x's for now.  The APIs are all unimplemented, so it doesn't do 
anything yet! :)
llvm-svn: 42868 
							
						 
						
							2007-10-11 18:38:32 +00:00  
				
					
						
							
							
								 
						
							
								e27d865e36 
								
							 
						 
						
							
							
								
								Initial checkin of rewriter interface.  It is just stubbed out for now.  
							
							... 
							
							
							
							llvm-svn: 41990 
							
						 
						
							2007-09-15 22:21:22 +00:00