aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-12-02 16:05:55 +0000
committerSteve Naroff <snaroff@apple.com>2008-12-02 16:05:55 +0000
commitdd2fdf13f11f93a8bd271807db25c71191914807 (patch)
tree028f7bb1ecebfc57426e782c39fa18ae6d032364
parent8de8d1d3f2e21e4a72ac294276930ad293a3a765 (diff)
Simplify previous commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60416 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Driver/RewriteObjC.cpp31
1 files changed, 14 insertions, 17 deletions
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());
}