aboutsummaryrefslogtreecommitdiff
path: root/Rewrite/Rewriter.cpp
AgeCommit message (Collapse)Author
2008-03-15Make a major restructuring of the clang tree: introduce a top-levelChris Lattner
lib dir and move all the libraries into it. This follows the main llvm tree, and allows the libraries to be built in parallel. The top level now enforces that all the libs are built before Driver, but we don't care what order the libs are built in. This speeds up parallel builds, particularly incremental ones. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48402 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31add some helper methods for removing and replacing text, this makes theChris Lattner
rewriter more robust. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46622 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31Make rewriter::inserttext return a bool to indicate if it failed.Chris Lattner
Add a RewriteTest::ReplaceStmt method to factor the 'checking for rewrite failed + emitting diagnostic if so' code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46619 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-23add some assertions so that the rewriter dies violently with a usefulChris Lattner
error instead of subtly with a mysterious one. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46287 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29Don't attribute in file headers anymore. See llvmdev for theChris Lattner
discussion of this change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45410 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08remove some temporary code.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43906 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08add a getAtOffset() member to simplify some code.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43905 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08Add a new RewriteRope data structure which is a smarter way to represent the ↵Chris Lattner
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43884 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08minor cleanupsChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43881 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08use std::copy instead of memcpy for abstraction.Chris Lattner
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43880 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08Fix a rewriter bug that fariborz hit, when an @interface was the very very veryChris Lattner
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43879 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06Fix an inverted conditional, Fariborz Jahanian
--chris git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43789 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-02Expose InsertText, fixing an oversight.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43643 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-25simplify change.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43348 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-25Fix a bug steve noticed when handling nested rewrites. We now turn this:Chris Lattner
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]; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43347 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-17Add new API to rewrite one stmt/expr with another.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43101 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-17The size returned by Rewriter::getRangeSize should includeChris Lattner
the size of the last token. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43092 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16Fix location processing of @encode: the range should include the @ sign.Chris Lattner
@selector probably gets this wrong also. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43048 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16Add a new Rewriter::getRangeSize method.Chris Lattner
Rename SourceRange::Begin()/End() to getBegin()/getEnd() for consistency with other code. Start building the rewriter towards handling @encode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43047 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16Push the rewriter forward a bit more. Now it rewritesChris Lattner
#import to #include's as a test. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43041 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-13haha, my devious plot is complete:Chris Lattner
$ clang rewrite.c -rewrite-test prints: int foo() { b: foo(); f: foo(); foo(); } for: int foo() { b: foo(); f: foo(); foo(); } amazing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42944 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-13With this I can now insert stuff before tabs, woo.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42942 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-13Woo, tab deletion now works. Next lets see if we can Chris Lattner
insert stuff. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42941 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-13another step forward in rewriter stuff. This still hasChris Lattner
some incredibly subtle details that I'm working on getting right. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42940 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-11Push the rewriting APIs along. Build a trivial client that replaces tabsChris Lattner
with x's for now. The APIs are all unimplemented, so it doesn't do anything yet! :) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42868 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-15Initial checkin of rewriter interface. It is just stubbed out for now.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41990 91177308-0d34-0410-b5e6-96231b3b80d8