]> granicus.if.org Git - clang/commitdiff
Fixed a property getter ir-gen crash.
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 1 Sep 2009 17:02:21 +0000 (17:02 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 1 Sep 2009 17:02:21 +0000 (17:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80681 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp
lib/CodeGen/CGObjC.cpp
test/CodeGenObjC/property-agrr-getter.m

index 48326ee832ef0c9ca0cda6cde54cff4aaebe9f3c..43120156f8a6031cb348381df1896528d7bc57bb 100644 (file)
@@ -1026,8 +1026,9 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
     if (PTy->getPointeeType()->isUnionType())
       isUnion = true;
     CVRQualifiers = PTy->getPointeeType().getCVRQualifiers();
-  } else if (isa<ObjCPropertyRefExpr>(BaseExpr) ||
-             isa<ObjCImplicitSetterGetterRefExpr>(BaseExpr)) {
+  } else if (isa<ObjCPropertyRefExpr>(BaseExpr->IgnoreParens()) ||
+             isa<ObjCImplicitSetterGetterRefExpr>(
+               BaseExpr->IgnoreParens())) {
     RValue RV = EmitObjCPropertyGet(BaseExpr);
     BaseValue = RV.getAggregateAddr();
     if (BaseExpr->getType()->isUnionType())
index 8c0c225d1ac6107f40e665bd698b11b1d591a69a..58999129813bb7ea83fa7d779c9e6e3d05aaada8 100644 (file)
@@ -327,6 +327,7 @@ RValue CodeGenFunction::EmitObjCSuperPropertyGet(const Expr *Exp,
 }
 
 RValue CodeGenFunction::EmitObjCPropertyGet(const Expr *Exp) {
+  Exp = Exp->IgnoreParens();
   // FIXME: Split it into two separate routines.
   if (const ObjCPropertyRefExpr *E = dyn_cast<ObjCPropertyRefExpr>(Exp)) {
     Selector S = E->getProperty()->getGetterName();
index 0e9b040b1b989936e54c987ae15ae2b1951620ed..46205796936f853e1dcb41ba00fea6d5b260e247 100644 (file)
@@ -15,3 +15,24 @@ typedef struct {
 }
 @end
 
+
+typedef struct _NSSize {
+    float width;
+    float height;
+} NSSize;
+
+
+@interface AnObject
+{
+ NSSize size;
+}
+
+@property NSSize size;
+
+@end
+
+float f ()
+{
+  AnObject* obj;
+  return (obj.size).width;
+}