forked from OSchip/llvm-project
Link against the correct ObjC string class (__CFConstantStringClassReference) and fix length computation (removing a FIXME).
llvm-svn: 48384
This commit is contained in:
parent
ce8e886731
commit
dad80ba9b1
|
@ -327,8 +327,8 @@ void RewriteTest::Initialize(ASTContext &context) {
|
||||||
S += " long length;\n";
|
S += " long length;\n";
|
||||||
S += " __NSConstantStringImpl(char *s, long l) :\n";
|
S += " __NSConstantStringImpl(char *s, long l) :\n";
|
||||||
S += " flags(0), str(s), length(l)\n";
|
S += " flags(0), str(s), length(l)\n";
|
||||||
S += " { extern struct objc_object *_NSConstantStringClassReference;\n";
|
S += " { extern int __CFConstantStringClassReference[];\n";
|
||||||
S += " isa = _NSConstantStringClassReference; }\n";
|
S += " isa = (struct objc_object *)__CFConstantStringClassReference;}\n";
|
||||||
S += "};\n";
|
S += "};\n";
|
||||||
S += "#define __NSCONSTANTSTRINGIMPL\n";
|
S += "#define __NSCONSTANTSTRINGIMPL\n";
|
||||||
S += "#endif\n";
|
S += "#endif\n";
|
||||||
|
@ -1737,9 +1737,8 @@ Stmt *RewriteTest::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) {
|
||||||
Exp->getString()->printPretty(prettyBuf);
|
Exp->getString()->printPretty(prettyBuf);
|
||||||
StrObjDecl += prettyBuf.str();
|
StrObjDecl += prettyBuf.str();
|
||||||
StrObjDecl += ",";
|
StrObjDecl += ",";
|
||||||
// FIXME: This length isn't correct. It doesn't include escape characters
|
// The minus 2 removes the begin/end double quotes.
|
||||||
// inserted by the pretty printer.
|
StrObjDecl += utostr(prettyBuf.str().size()-2) + ");\n";
|
||||||
StrObjDecl += utostr(Exp->getString()->getByteLength()) + ");\n";
|
|
||||||
InsertText(SourceLocation::getFileLoc(MainFileID, 0),
|
InsertText(SourceLocation::getFileLoc(MainFileID, 0),
|
||||||
StrObjDecl.c_str(), StrObjDecl.size());
|
StrObjDecl.c_str(), StrObjDecl.size());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue