aboutsummaryrefslogtreecommitdiff
path: root/Driver/RewriteTest.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-03-15 01:36:04 +0000
committerSteve Naroff <snaroff@apple.com>2008-03-15 01:36:04 +0000
commit3652c2d8df0b594cf9b552eaedfd3ed7fbbed0f6 (patch)
tree882c4707f48efd9b737fbd4d6be7997ddce21688 /Driver/RewriteTest.cpp
parentd82a9ab4540899e24c96a389c5488381c5551c78 (diff)
Link against the correct ObjC string class (__CFConstantStringClassReference) and fix length computation (removing a FIXME).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48384 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/RewriteTest.cpp')
-rw-r--r--Driver/RewriteTest.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp
index 3ada2b88de..e947f243f2 100644
--- a/Driver/RewriteTest.cpp
+++ b/Driver/RewriteTest.cpp
@@ -327,8 +327,8 @@ void RewriteTest::Initialize(ASTContext &context) {
S += " long length;\n";
S += " __NSConstantStringImpl(char *s, long l) :\n";
S += " flags(0), str(s), length(l)\n";
- S += " { extern struct objc_object *_NSConstantStringClassReference;\n";
- S += " isa = _NSConstantStringClassReference; }\n";
+ S += " { extern int __CFConstantStringClassReference[];\n";
+ S += " isa = (struct objc_object *)__CFConstantStringClassReference;}\n";
S += "};\n";
S += "#define __NSCONSTANTSTRINGIMPL\n";
S += "#endif\n";
@@ -1737,9 +1737,8 @@ Stmt *RewriteTest::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) {
Exp->getString()->printPretty(prettyBuf);
StrObjDecl += prettyBuf.str();
StrObjDecl += ",";
- // FIXME: This length isn't correct. It doesn't include escape characters
- // inserted by the pretty printer.
- StrObjDecl += utostr(Exp->getString()->getByteLength()) + ");\n";
+ // The minus 2 removes the begin/end double quotes.
+ StrObjDecl += utostr(prettyBuf.str().size()-2) + ");\n";
InsertText(SourceLocation::getFileLoc(MainFileID, 0),
StrObjDecl.c_str(), StrObjDecl.size());