aboutsummaryrefslogtreecommitdiff
path: root/Driver/RewriteTest.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2007-10-30 02:23:23 +0000
committerSteve Naroff <snaroff@apple.com>2007-10-30 02:23:23 +0000
commitf908a87299d278164540f90b5b6e6cab7b14fb41 (patch)
tree1b9481a18091f3c3196af8b1a2213bd2ed98ded1 /Driver/RewriteTest.cpp
parentc0a87b7db06643178ad2cbce0767548c139ea387 (diff)
More support for rewriting ObjC intefaces. Still some edge cases to handle...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43493 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/RewriteTest.cpp')
-rw-r--r--Driver/RewriteTest.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp
index c76b9eeba9..8063574750 100644
--- a/Driver/RewriteTest.cpp
+++ b/Driver/RewriteTest.cpp
@@ -264,6 +264,27 @@ void RewriteTest::RewriteForwardClassDecl(ObjcClassDecl *ClassDecl) {
}
void RewriteTest::RewriteInterfaceDecl(ObjcInterfaceDecl *ClassDecl) {
+
+ SourceLocation LocStart = ClassDecl->getLocStart();
+ SourceLocation LocEnd = ClassDecl->getLocEnd();
+
+ const char *startBuf = SM->getCharacterData(LocStart);
+ const char *endBuf = SM->getCharacterData(LocEnd);
+
+ // FIXME: need to consider empty class decls (no vars, methods)...
+ // @interface NSConstantString : NSSimpleCString
+ // @end
+
+ if (*endBuf != '>' && *endBuf != '}')
+ // we have an identifier - scan ahead until the end of token.
+ endBuf = strchr(endBuf, ' '); // FIXME: implement correctly.
+
+ std::string ResultStr;
+ SynthesizeObjcInternalStruct(ClassDecl, ResultStr);
+
+ Rewrite.ReplaceText(LocStart, endBuf-startBuf+1,
+ ResultStr.c_str(), ResultStr.size());
+
int nInstanceMethods = ClassDecl->getNumInstanceMethods();
ObjcMethodDecl **instanceMethods = ClassDecl->getInstanceMethods();