From: Steve Naroff Date: Tue, 2 Dec 2008 16:05:55 +0000 (+0000) Subject: Simplify previous commit. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dd2fdf13f11f93a8bd271807db25c71191914807;p=clang Simplify previous commit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60416 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/RewriteObjC.cpp b/Driver/RewriteObjC.cpp index 7f55d793d7..68ba314c11 100644 --- a/Driver/RewriteObjC.cpp +++ b/Driver/RewriteObjC.cpp @@ -609,19 +609,19 @@ void RewriteObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID) { return; // FIXME: is this correct? // Generate the 'getter' function. - std::string Getr; ObjCPropertyDecl *PD = PID->getPropertyDecl(); - - RewriteObjCMethodDecl(PD->getGetterMethodDecl(), Getr); ObjCInterfaceDecl *ClassDecl = PD->getGetterMethodDecl()->getClassInterface(); - - Getr += "{ "; ObjCIvarDecl *OID = PID->getPropertyIvarDecl(); - if (OID) { - // Synthesize an explicit cast to gain access to the ivar. - Getr += "return " + getIvarAccessString(ClassDecl, OID); - Getr += "; }"; - } + + if (!OID) + return; + + std::string Getr; + RewriteObjCMethodDecl(PD->getGetterMethodDecl(), Getr); + Getr += "{ "; + // Synthesize an explicit cast to gain access to the ivar. + Getr += "return " + getIvarAccessString(ClassDecl, OID); + Getr += "; }"; InsertText(onePastSemiLoc, Getr.c_str(), Getr.size()); if (PD->isReadOnly()) @@ -630,14 +630,11 @@ void RewriteObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID) { // Generate the 'setter' function. std::string Setr; RewriteObjCMethodDecl(PD->getSetterMethodDecl(), Setr); - Setr += "{ "; - if (OID) { - // Synthesize an explicit cast to initialize the ivar. - Setr += getIvarAccessString(ClassDecl, OID) + " = "; - Setr += OID->getNameAsCString(); - Setr += "; }"; - } + // Synthesize an explicit cast to initialize the ivar. + Setr += getIvarAccessString(ClassDecl, OID) + " = "; + Setr += OID->getNameAsCString(); + Setr += "; }"; InsertText(onePastSemiLoc, Setr.c_str(), Setr.size()); }