llvm::SmallVector<ObjcImplementationDecl *, 8> ClassImplementation;
llvm::SmallVector<ObjcCategoryImplDecl *, 8> CategoryImplementation;
llvm::SmallPtrSet<ObjcInterfaceDecl*, 8> ObjcSynthesizedStructs;
+ llvm::SmallPtrSet<ObjcInterfaceDecl*, 8> ObjcForwardDecls;
FunctionDecl *MsgSendFunctionDecl;
FunctionDecl *GetClassFunctionDecl;
typedefString += "\n";
for (int i = 0; i < numDecls; i++) {
ObjcInterfaceDecl *ForwardDecl = ForwardDecls[i];
+ if (ObjcForwardDecls.count(ForwardDecl))
+ continue;
typedefString += "typedef struct ";
typedefString += ForwardDecl->getName();
typedefString += " ";
typedefString += ForwardDecl->getName();
typedefString += ";\n";
+
+ // Mark this typedef as having been generated.
+ if (!ObjcForwardDecls.insert(ForwardDecl))
+ assert(true && "typedef already output");
}
// Replace the @class with typedefs corresponding to the classes.
SelGetUidFunctionDecl = FD;
return;
}
- return; // FIXME: remove when the code below is ready.
// Check for ObjC 'id' and class types that have been adorned with protocol
// information (id<p>, C<p>*). The protocol references need to be rewritten!
const FunctionType *funcType = FD->getType()->getAsFunctionType();
}
else
Result += " {";
+
if (NumIvars > 0) {
SourceLocation LocStart = CDecl->getLocStart();
SourceLocation LocEnd = CDecl->getLocEnd();
Result += "};\n";
// Mark this struct as having been generated.
if (!ObjcSynthesizedStructs.insert(CDecl))
- assert(true && "struct already synthesize- SynthesizeObjcInternalStruct");
+ assert(true && "struct already synthesize- SynthesizeObjcInternalStruct");
}
// RewriteObjcMethodsMetaData - Rewrite methods metadata for instance or
}
}
SourceLocation RBraceLoc = MatchRHSPunctuation(tok::r_brace, LBraceLoc);
- if (AllIvarDecls.size()) { // Check for {} - no ivars in braces
- Actions.ActOnFields(CurScope, atLoc, interfaceDecl,
- &AllIvarDecls[0], AllIvarDecls.size(),
- LBraceLoc, RBraceLoc, &AllVisibilities[0]);
- }
+ // Call ActOnFields() even if we don't have any decls. This is useful
+ // for code rewriting tools that need to be aware of the empty list.
+ Actions.ActOnFields(CurScope, atLoc, interfaceDecl,
+ &AllIvarDecls[0], AllIvarDecls.size(),
+ LBraceLoc, RBraceLoc, &AllVisibilities[0]);
return;
}