aboutsummaryrefslogtreecommitdiff
path: root/Driver/RewriteTest.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-03-18 01:47:18 +0000
committerSteve Naroff <snaroff@apple.com>2008-03-18 01:47:18 +0000
commit2a22816a1a3f08d2154f2ce319ff1c66f2d72978 (patch)
tree2399b89b3c28895d9285e62f860461694d63642d /Driver/RewriteTest.cpp
parent58cda6ff1cd0b613fb54d74bb126f30e757f0f0f (diff)
Wrap up __NSConstantStringImpl (the replacement for __builtin___CFStringMakeConstantString).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48477 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/RewriteTest.cpp')
-rw-r--r--Driver/RewriteTest.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp
index 927053e162..4f27ab9005 100644
--- a/Driver/RewriteTest.cpp
+++ b/Driver/RewriteTest.cpp
@@ -321,15 +321,12 @@ void RewriteTest::Initialize(ASTContext &context) {
S += "#endif\n";
S += "#ifndef __NSCONSTANTSTRINGIMPL\n";
S += "struct __NSConstantStringImpl {\n";
- S += " struct objc_object *isa;\n";
+ S += " int *isa;\n";
S += " int flags;\n";
S += " char *str;\n";
S += " long length;\n";
- S += " __NSConstantStringImpl(char *s, long l) :\n";
- S += " flags(0), str(s), length(l)\n";
- S += " { extern int __CFConstantStringClassReference[];\n";
- S += " isa = (struct objc_object *)__CFConstantStringClassReference;}\n";
S += "};\n";
+ S += "extern int __CFConstantStringClassReference[];\n";
S += "#define __NSCONSTANTSTRINGIMPL\n";
S += "#endif\n";
#if 0
@@ -1733,14 +1730,15 @@ Stmt *RewriteTest::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) {
S += utostr(NumObjCStringLiterals++);
std::string StrObjDecl = "static __NSConstantStringImpl " + S;
- StrObjDecl += " = __NSConstantStringImpl(";
+ StrObjDecl += " __attribute__ ((section (\"__DATA, __cfstring\"))) = {__CFConstantStringClassReference,";
+ StrObjDecl += "0x000007c8,"; // utf8_str
// The pretty printer for StringLiteral handles escape characters properly.
std::ostringstream prettyBuf;
Exp->getString()->printPretty(prettyBuf);
StrObjDecl += prettyBuf.str();
StrObjDecl += ",";
// The minus 2 removes the begin/end double quotes.
- StrObjDecl += utostr(prettyBuf.str().size()-2) + ");\n";
+ StrObjDecl += utostr(prettyBuf.str().size()-2) + "};\n";
InsertText(SourceLocation::getFileLoc(MainFileID, 0),
StrObjDecl.c_str(), StrObjDecl.size());