summaryrefslogtreecommitdiffstats
path: root/clang/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
commit034bcb5bfac5ed7fb6191737673d39102b3a3a33 (patch)
tree81d62b87e5712beb5279cc6f23a952209043c508 /clang/Driver/RewriteTest.cpp
parent864970e9b629e34e39f1a8b80c01d196ebf706de (diff)
downloadbcm5719-llvm-034bcb5bfac5ed7fb6191737673d39102b3a3a33.tar.gz
bcm5719-llvm-034bcb5bfac5ed7fb6191737673d39102b3a3a33.zip
Wrap up __NSConstantStringImpl (the replacement for __builtin___CFStringMakeConstantString).
llvm-svn: 48477
Diffstat (limited to 'clang/Driver/RewriteTest.cpp')
-rw-r--r--clang/Driver/RewriteTest.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/clang/Driver/RewriteTest.cpp b/clang/Driver/RewriteTest.cpp
index 927053e1629..4f27ab90057 100644
--- a/clang/Driver/RewriteTest.cpp
+++ b/clang/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());
OpenPOWER on IntegriCloud