From: Steve Naroff Date: Wed, 14 Nov 2007 23:02:56 +0000 (+0000) Subject: Always generate a typedef for @class. The typedef removal logic that I'm removing... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5086a8df9a269acc2e4f0deb1895d4a9e9d13f4d;p=clang 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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44145 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp index d953e08581..286b493ddb 100644 --- a/Driver/RewriteTest.cpp +++ b/Driver/RewriteTest.cpp @@ -313,8 +313,6 @@ void RewriteTest::RewriteForwardClassDecl(ObjcClassDecl *ClassDecl) { 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 @@ void RewriteTest::RewriteForwardClassDecl(ObjcClassDecl *ClassDecl) { 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 @@ void RewriteTest::RewriteInterfaceDecl(ObjcInterfaceDecl *ClassDecl) { 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_";