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

Steve Naroff snaroff at apple.com
Wed Nov 14 15:02:56 PST 2007


Author: snaroff
Date: Wed Nov 14 17:02:56 2007
New Revision: 44145

URL: http://llvm.org/viewvc/llvm-project?rev=44145&view=rev
Log:

Always generate a typedef for @class. The typedef removal logic that I'm removing only made sense when we were operating on preprocess files without typedef guards. Now that we have guards, it is incorrect to ever remove one (since it may increase the likelihood that the rewritten header can't be included stand alone).


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=44145&r1=44144&r2=44145&view=diff

==============================================================================
--- cfe/trunk/Driver/RewriteTest.cpp (original)
+++ cfe/trunk/Driver/RewriteTest.cpp Wed Nov 14 17:02:56 2007
@@ -313,8 +313,6 @@
   typedefString += "\n";
   for (int i = 0; i < numDecls; i++) {
     ObjcInterfaceDecl *ForwardDecl = ForwardDecls[i];
-    if (ObjcForwardDecls.count(ForwardDecl))
-      continue;
     typedefString += "#ifndef _REWRITER_typedef_";
     typedefString += ForwardDecl->getName();
     typedefString += "\n";
@@ -324,9 +322,6 @@
     typedefString += "typedef struct objc_object ";
     typedefString += ForwardDecl->getName();
     typedefString += ";\n#endif\n";
-    // Mark this typedef as having been generated.
-    if (!ObjcForwardDecls.insert(ForwardDecl))
-      assert(false && "typedef already output");
   }
   
   // Replace the @class with typedefs corresponding to the classes.
@@ -544,7 +539,7 @@
   std::string ResultStr;
   if (!ObjcForwardDecls.count(ClassDecl)) {
     // we haven't seen a forward decl - generate a typedef.
-    ResultStr += "#ifndef _REWRITER_typedef_";
+    ResultStr = "#ifndef _REWRITER_typedef_";
     ResultStr += ClassDecl->getName();
     ResultStr += "\n";
     ResultStr += "#define _REWRITER_typedef_";





More information about the cfe-commits mailing list