aboutsummaryrefslogtreecommitdiff
path: root/Driver/RewriteTest.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2007-11-14 14:34:23 +0000
committerSteve Naroff <snaroff@apple.com>2007-11-14 14:34:23 +0000
commit1d098f66d424772364f0f9f7c452fe37bbc3bf71 (patch)
tree7869da0851c80c9a58a5bd7954b6f03951744484 /Driver/RewriteTest.cpp
parentddd600f3281f6c23564afc17550e186ca9c43631 (diff)
Rewrite methods that span multiple lines.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44118 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/RewriteTest.cpp')
-rw-r--r--Driver/RewriteTest.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp
index 78cd90e9a9..283f360234 100644
--- a/Driver/RewriteTest.cpp
+++ b/Driver/RewriteTest.cpp
@@ -336,11 +336,15 @@ void RewriteTest::RewriteForwardClassDecl(ObjcClassDecl *ClassDecl) {
void RewriteTest::RewriteMethodDeclarations(int nMethods, ObjcMethodDecl **Methods) {
for (int i = 0; i < nMethods; i++) {
ObjcMethodDecl *Method = Methods[i];
- SourceLocation Loc = Method->getLocStart();
-
- Rewrite.InsertText(Loc, "// ", 3);
+ SourceLocation LocStart = Method->getLocStart();
+ SourceLocation LocEnd = Method->getLocEnd();
- // FIXME: handle methods that are declared across multiple lines.
+ if (SM->getLineNumber(LocEnd) > SM->getLineNumber(LocStart)) {
+ Rewrite.InsertText(LocStart, "/* ", 3);
+ Rewrite.ReplaceText(LocEnd, 1, ";*/ ", 4);
+ } else {
+ Rewrite.InsertText(LocStart, "// ", 3);
+ }
}
}