[cfe-commits] r44119 - /cfe/trunk/Driver/RewriteTest.cpp
Steve Naroff
snaroff at apple.com
Wed Nov 14 07:03:57 PST 2007
Author: snaroff
Date: Wed Nov 14 09:03:57 2007
New Revision: 44119
URL: http://llvm.org/viewvc/llvm-project?rev=44119&view=rev
Log:
Fix yesterday's regression with rewriting @optional/@required.
Modified:
cfe/trunk/Driver/RewriteTest.cpp
Modified: cfe/trunk/Driver/RewriteTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteTest.cpp?rev=44119&r1=44118&r2=44119&view=diff
==============================================================================
--- cfe/trunk/Driver/RewriteTest.cpp (original)
+++ cfe/trunk/Driver/RewriteTest.cpp Wed Nov 14 09:03:57 2007
@@ -390,29 +390,26 @@
// 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) {
More information about the cfe-commits
mailing list