aboutsummaryrefslogtreecommitdiff
path: root/Driver/RewriteTest.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2007-11-14 15:03:57 +0000
committerSteve Naroff <snaroff@apple.com>2007-11-14 15:03:57 +0000
commit8cc764c67afc249628ba4f65b8e2d2ad461112ff (patch)
tree1a0b85790dd8fb36ace73ce6cb19807d739682e0 /Driver/RewriteTest.cpp
parent1d098f66d424772364f0f9f7c452fe37bbc3bf71 (diff)
Fix yesterday's regression with rewriting @optional/@required.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44119 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/RewriteTest.cpp')
-rw-r--r--Driver/RewriteTest.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp
index 283f360234..b78e776f18 100644
--- a/Driver/RewriteTest.cpp
+++ b/Driver/RewriteTest.cpp
@@ -390,29 +390,26 @@ void RewriteTest::RewriteProtocolDecl(ObjcProtocolDecl *PDecl) {
// Lastly, comment out the @end.
SourceLocation LocEnd = PDecl->getAtEndLoc();
Rewrite.ReplaceText(LocEnd, 0, "// ", 3);
-#if 0
+
// Must comment out @optional/@required
const char *startBuf = SM->getCharacterData(LocStart);
const char *endBuf = SM->getCharacterData(LocEnd);
for (const char *p = startBuf; p < endBuf; p++) {
if (*p == '@' && !strncmp(p+1, "optional", strlen("optional"))) {
std::string CommentedOptional = "/* @optional */";
- SourceLocation OptionalLoc = SourceLocation::getFileLoc(MainFileID,
- p-MainBufStart);
+ SourceLocation OptionalLoc = LocStart.getFileLocWithOffset(p-startBuf);
Rewrite.ReplaceText(OptionalLoc, strlen("@optional"),
CommentedOptional.c_str(), CommentedOptional.size());
}
else if (*p == '@' && !strncmp(p+1, "required", strlen("required"))) {
std::string CommentedRequired = "/* @required */";
- SourceLocation OptionalLoc = SourceLocation::getFileLoc(MainFileID,
- p-MainBufStart);
+ SourceLocation OptionalLoc = LocStart.getFileLocWithOffset(p-startBuf);
Rewrite.ReplaceText(OptionalLoc, strlen("@required"),
CommentedRequired.c_str(), CommentedRequired.size());
}
}
-#endif
}
void RewriteTest::RewriteForwardProtocolDecl(ObjcForwardProtocolDecl *PDecl) {