From: Steve Naroff Date: Fri, 14 Nov 2008 14:10:01 +0000 (+0000) Subject: Fix clang ObjC rewriter: Too many _objc_symtab, _OBJC_SYMBOLS X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0aab796da21bfc45381d3ce76c795710cb97acfc;p=clang Fix clang ObjC rewriter: Too many _objc_symtab, _OBJC_SYMBOLS git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59301 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/RewriteObjC.cpp b/Driver/RewriteObjC.cpp index 14971207a4..d4774467df 100644 --- a/Driver/RewriteObjC.cpp +++ b/Driver/RewriteObjC.cpp @@ -3076,8 +3076,6 @@ void RewriteObjC::RewriteImplementations() { int ClsDefCount = ClassImplementation.size(); int CatDefCount = CategoryImplementation.size(); - if (ClsDefCount == 0 && CatDefCount == 0) - return; // Rewrite implemented methods for (int i = 0; i < ClsDefCount; i++) RewriteImplementationDecl(ClassImplementation[i]); @@ -4131,7 +4129,8 @@ void RewriteObjC::HandleTranslationUnit(TranslationUnit& TU) { InsertText(SourceLocation::getFileLoc(MainFileID, 0), Preamble.c_str(), Preamble.size(), false); - RewriteImplementations(); + if (ClassImplementation.size() || CategoryImplementation.size()) + RewriteImplementations(); // Get the buffer corresponding to MainFileID. If we haven't changed it, then // we are done. @@ -4143,12 +4142,13 @@ void RewriteObjC::HandleTranslationUnit(TranslationUnit& TU) { fprintf(stderr, "No changes\n"); } - // Rewrite Objective-c meta data* - std::string ResultStr; - SynthesizeMetaDataIntoBuffer(ResultStr); - - // Emit metadata. - *OutFile << ResultStr; + if (ClassImplementation.size() || CategoryImplementation.size()) { + // Rewrite Objective-c meta data* + std::string ResultStr; + SynthesizeMetaDataIntoBuffer(ResultStr); + // Emit metadata. + *OutFile << ResultStr; + } OutFile->flush(); }