Fix <rdar://problem/6370288> clang ObjC rewriter: Too many _objc_symtab, _OBJC_SYMBOLS

llvm-svn: 59301
This commit is contained in:
Steve Naroff 2008-11-14 14:10:01 +00:00
parent be35ce953e
commit 2a2a41fa11
1 changed files with 9 additions and 9 deletions

View File

@ -3076,8 +3076,6 @@ void RewriteObjC::RewriteImplementations() {
int ClsDefCount = ClassImplementation.size(); int ClsDefCount = ClassImplementation.size();
int CatDefCount = CategoryImplementation.size(); int CatDefCount = CategoryImplementation.size();
if (ClsDefCount == 0 && CatDefCount == 0)
return;
// Rewrite implemented methods // Rewrite implemented methods
for (int i = 0; i < ClsDefCount; i++) for (int i = 0; i < ClsDefCount; i++)
RewriteImplementationDecl(ClassImplementation[i]); RewriteImplementationDecl(ClassImplementation[i]);
@ -4131,6 +4129,7 @@ void RewriteObjC::HandleTranslationUnit(TranslationUnit& TU) {
InsertText(SourceLocation::getFileLoc(MainFileID, 0), InsertText(SourceLocation::getFileLoc(MainFileID, 0),
Preamble.c_str(), Preamble.size(), false); Preamble.c_str(), Preamble.size(), false);
if (ClassImplementation.size() || CategoryImplementation.size())
RewriteImplementations(); RewriteImplementations();
// Get the buffer corresponding to MainFileID. If we haven't changed it, then // Get the buffer corresponding to MainFileID. If we haven't changed it, then
@ -4143,12 +4142,13 @@ void RewriteObjC::HandleTranslationUnit(TranslationUnit& TU) {
fprintf(stderr, "No changes\n"); fprintf(stderr, "No changes\n");
} }
if (ClassImplementation.size() || CategoryImplementation.size()) {
// Rewrite Objective-c meta data* // Rewrite Objective-c meta data*
std::string ResultStr; std::string ResultStr;
SynthesizeMetaDataIntoBuffer(ResultStr); SynthesizeMetaDataIntoBuffer(ResultStr);
// Emit metadata. // Emit metadata.
*OutFile << ResultStr; *OutFile << ResultStr;
}
OutFile->flush(); OutFile->flush();
} }