[cfe-commits] r48384 - /cfe/trunk/Driver/RewriteTest.cpp

Steve Naroff snaroff at apple.com
Fri Mar 14 18:36:04 PDT 2008


Author: snaroff
Date: Fri Mar 14 20:36:04 2008
New Revision: 48384

URL: http://llvm.org/viewvc/llvm-project?rev=48384&view=rev
Log:
Link against the correct ObjC string class (__CFConstantStringClassReference) and fix length computation (removing a FIXME).

Modified:
    cfe/trunk/Driver/RewriteTest.cpp

Modified: cfe/trunk/Driver/RewriteTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteTest.cpp?rev=48384&r1=48383&r2=48384&view=diff

==============================================================================
--- cfe/trunk/Driver/RewriteTest.cpp (original)
+++ cfe/trunk/Driver/RewriteTest.cpp Fri Mar 14 20:36:04 2008
@@ -327,8 +327,8 @@
   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 @@
   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());
   





More information about the cfe-commits mailing list