[cfe-commits] r60416 - /cfe/trunk/Driver/RewriteObjC.cpp
Steve Naroff
snaroff at apple.com
Tue Dec 2 08:05:56 PST 2008
Author: snaroff
Date: Tue Dec 2 10:05:55 2008
New Revision: 60416
URL: http://llvm.org/viewvc/llvm-project?rev=60416&view=rev
Log:
Simplify previous commit.
Modified:
cfe/trunk/Driver/RewriteObjC.cpp
Modified: cfe/trunk/Driver/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteObjC.cpp?rev=60416&r1=60415&r2=60416&view=diff
==============================================================================
--- cfe/trunk/Driver/RewriteObjC.cpp (original)
+++ cfe/trunk/Driver/RewriteObjC.cpp Tue Dec 2 10:05:55 2008
@@ -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());
}
More information about the cfe-commits
mailing list