aboutsummaryrefslogtreecommitdiff
path: root/Driver/RewriteTest.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-11-08 04:41:51 +0000
committerChris Lattner <sabre@nondot.org>2007-11-08 04:41:51 +0000
commit28d1fe893914f429495edb7ef45853ad052bf698 (patch)
tree33710eb3b469fe6e759de7d6915e0681f1e1e227 /Driver/RewriteTest.cpp
parentd425a27cd06d6bacadd146ca8f558f9f8c97194c (diff)
use insert instead of replacing 0 bytes with text :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43882 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/RewriteTest.cpp')
-rw-r--r--Driver/RewriteTest.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp
index a7f1c209b3..d5657694c5 100644
--- a/Driver/RewriteTest.cpp
+++ b/Driver/RewriteTest.cpp
@@ -315,7 +315,7 @@ void RewriteTest::RewriteMethods(int nMethods, ObjcMethodDecl **Methods) {
ObjcMethodDecl *Method = Methods[i];
SourceLocation Loc = Method->getLocStart();
- Rewrite.ReplaceText(Loc, 0, "// ", 3);
+ Rewrite.InsertText(Loc, "// ", 3);
// FIXME: handle methods that are declared across multiple lines.
}
@@ -483,7 +483,7 @@ Stmt *RewriteTest::RewriteObjcTryStmt(ObjcAtTryStmt *S) {
buf += " _rethrow = objc_exception_extract(&_stack);\n";
buf += " else { /* @catch continue */";
- Rewrite.ReplaceText(startLoc, 0, buf.c_str(), buf.size());
+ Rewrite.InsertText(startLoc, buf.c_str(), buf.size());
bool sawIdTypedCatch = false;
Stmt *lastCatchBody = 0;
@@ -548,7 +548,7 @@ Stmt *RewriteTest::RewriteObjcTryStmt(ObjcAtTryStmt *S) {
bodyLoc = bodyLoc.getFileLocWithOffset(1);
buf = " } } /* @catch end */\n";
- Rewrite.ReplaceText(bodyLoc, 0, buf.c_str(), buf.size());
+ Rewrite.InsertText(bodyLoc, buf.c_str(), buf.size());
// Set lastCurlyLoc
lastCurlyLoc = lastCatchBody->getLocEnd();
@@ -571,10 +571,10 @@ Stmt *RewriteTest::RewriteObjcTryStmt(ObjcAtTryStmt *S) {
startLoc = startLoc.getFileLocWithOffset(1);
buf = " if (!_rethrow) objc_exception_try_exit(&_stack);\n";
- Rewrite.ReplaceText(startLoc, 0, buf.c_str(), buf.size());
+ Rewrite.InsertText(startLoc, buf.c_str(), buf.size());
endLoc = endLoc.getFileLocWithOffset(-1);
buf = " if (_rethrow) objc_exception_throw(_rethrow);\n";
- Rewrite.ReplaceText(endLoc, 0, buf.c_str(), buf.size());
+ Rewrite.InsertText(endLoc, buf.c_str(), buf.size());
// Set lastCurlyLoc
lastCurlyLoc = body->getLocEnd();
@@ -582,7 +582,7 @@ Stmt *RewriteTest::RewriteObjcTryStmt(ObjcAtTryStmt *S) {
// Now emit the final closing curly brace...
lastCurlyLoc = lastCurlyLoc.getFileLocWithOffset(1);
buf = " } /* @try scope end */\n";
- Rewrite.ReplaceText(lastCurlyLoc, 0, buf.c_str(), buf.size());
+ Rewrite.InsertText(lastCurlyLoc, buf.c_str(), buf.size());
return 0;
}
@@ -707,8 +707,8 @@ void RewriteTest::RewriteObjcQualifiedInterfaceTypes(
SourceLocation LessLoc = Loc.getFileLocWithOffset(startRef-endBuf);
SourceLocation GreaterLoc = Loc.getFileLocWithOffset(endRef-endBuf+1);
// Comment out the protocol references.
- Rewrite.ReplaceText(LessLoc, 0, "/*", 2);
- Rewrite.ReplaceText(GreaterLoc, 0, "*/", 2);
+ Rewrite.InsertText(LessLoc, "/*", 2);
+ Rewrite.InsertText(GreaterLoc, "*/", 2);
}
}
// Now check arguments.
@@ -727,8 +727,8 @@ void RewriteTest::RewriteObjcQualifiedInterfaceTypes(
SourceLocation LessLoc = Loc.getFileLocWithOffset(startRef-startBuf);
SourceLocation GreaterLoc = Loc.getFileLocWithOffset(endRef-startBuf+1);
// Comment out the protocol references.
- Rewrite.ReplaceText(LessLoc, 0, "/*", 2);
- Rewrite.ReplaceText(GreaterLoc, 0, "*/", 2);
+ Rewrite.InsertText(LessLoc, "/*", 2);
+ Rewrite.InsertText(GreaterLoc, "*/", 2);
}
}
}