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 7f55d79..68ba314 100644
--- a/Driver/RewriteObjC.cpp
+++ b/Driver/RewriteObjC.cpp
@@ -609,19 +609,19 @@
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 @@
// 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());
}