Fix <rdar://problem/6435382> clang ObjC rewriter: @property/@synthesize and blocks don't work together

llvm-svn: 60887
This commit is contained in:
Steve Naroff 2008-12-11 19:29:16 +00:00
parent 21a6370323
commit 1fa7bd16c8
1 changed files with 11 additions and 8 deletions

View File

@ -720,7 +720,7 @@ void RewriteObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID,
// attributes (copy, retain, nonatomic).
// See objc-act.c:objc_synthesize_new_setter() for details.
Setr += getIvarAccessString(ClassDecl, OID) + " = ";
Setr += OID->getNameAsCString();
Setr += PD->getNameAsCString();
Setr += "; }";
InsertText(onePastSemiLoc, Setr.c_str(), Setr.size());
@ -861,17 +861,20 @@ void RewriteObjC::RewriteObjCMethodDecl(ObjCMethodDecl *OMD,
ResultStr += "\nstatic ";
if (OMD->getResultType()->isObjCQualifiedIdType())
ResultStr += "id";
else if (OMD->getResultType()->isFunctionPointerType()) {
else if (OMD->getResultType()->isFunctionPointerType() ||
OMD->getResultType()->isBlockPointerType()) {
// needs special handling, since pointer-to-functions have special
// syntax (where a decaration models use).
QualType retType = OMD->getResultType();
if (const PointerType* PT = retType->getAsPointerType()) {
QualType PointeeTy = PT->getPointeeType();
QualType PointeeTy;
if (const PointerType* PT = retType->getAsPointerType())
PointeeTy = PT->getPointeeType();
else if (const BlockPointerType *BPT = retType->getAsBlockPointerType())
PointeeTy = BPT->getPointeeType();
if ((FPRetType = PointeeTy->getAsFunctionType())) {
ResultStr += FPRetType->getResultType().getAsString();
ResultStr += "(*";
}
}
} else
ResultStr += OMD->getResultType().getAsString();
ResultStr += " ";