void RewriteObjC::RewriteObjCMethodDecl(ObjCMethodDecl *OMD,
std::string &ResultStr) {
+ //fprintf(stderr,"In RewriteObjCMethodDecl\n");
const FunctionType *FPRetType = 0;
ResultStr += "\nstatic ";
if (OMD->getResultType()->isObjCQualifiedIdType())
cursor++;
atLoc = LocStart.getFileLocWithOffset(cursor-startBuf);
InsertText(atLoc, " */", 3);
+ } else if (*cursor == '^') { // rewrite block specifier.
+ SourceLocation caretLoc = LocStart.getFileLocWithOffset(cursor-startBuf);
+ ReplaceText(caretLoc, 1, "*", 1);
}
cursor++;
}
std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
bool hasCopyDisposeHelpers) {
- std::string S = "struct " + Tag;
+ std::string S = "\nstruct " + Tag;
std::string Constructor = " " + Tag;
S += " {\n struct __block_impl impl;\n";
}
void RewriteObjC::InsertBlockLiteralsWithinMethod(ObjCMethodDecl *MD) {
- SourceLocation FunLocStart = MD->getLocStart();
+ //fprintf(stderr,"In InsertBlockLiteralsWitinMethod\n");
+ //SourceLocation FunLocStart = MD->getLocStart();
+ // FIXME: This hack works around a bug in Rewrite.InsertText().
+ SourceLocation FunLocStart = MD->getLocStart().getFileLocWithOffset(-1);
std::string FuncName = std::string(MD->getSelector().getName());
// Convert colons to underscores.
std::string::size_type loc = 0;