]> granicus.if.org Git - clang/commitdiff
Copying result of object property reference expression
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 27 Sep 2010 17:30:38 +0000 (17:30 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 27 Sep 2010 17:30:38 +0000 (17:30 +0000)
into a temporary is elidable as well.
(Finishes up radar 8291337).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114845 91177308-0d34-0410-b5e6-96231b3b80d8

clang.xcodeproj/project.pbxproj
lib/AST/Expr.cpp
test/CodeGenObjCXX/property-object-conditional-exp.mm

index def722b45e463c55b4f4ac94bb02bbf68520f5b7..2a256450887b2e8161fdfa1d9101a31e9aac1d7a 100644 (file)
                        isa = PBXProject;
                        buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
                        compatibilityVersion = "Xcode 2.4";
-                       developmentRegion = English;
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
index dbfe2d52b88405301c6b53e3f5e91aea48e0b379..9536b9bf2454618c7d84eb5d07e1bbd0a387f274 100644 (file)
@@ -1661,7 +1661,12 @@ bool Expr::isTemporaryObject(ASTContext &C, const CXXRecordDecl *TempTy) const {
   const Expr *E = skipTemporaryBindingsAndNoOpCasts(this);
 
   // Temporaries are by definition pr-values of class type.
-  if (!E->Classify(C).isPRValue()) return false;
+  if (!E->Classify(C).isPRValue()) {
+    // In this context, property reference is a message call and is pr-value.
+    if (!isa<ObjCPropertyRefExpr>(E) && 
+        !isa<ObjCImplicitSetterGetterRefExpr>(E))
+      return false;
+  }
 
   // Black-list a few cases which yield pr-values of class type that don't
   // refer to temporaries of that type:
index 0f44a2248a23deae8271b77f006971333a7b2fb2..826c351e79efa90e59d508227ee3ec7e8a2448f8 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
 
 struct CGRect {
   char* origin;
@@ -22,6 +22,8 @@ extern "C" bool CGRectIsEmpty(CGRect);
     CGRect dataRect;
     CGRect virtualBounds;
 
+// CHECK: [[SRC:%.*]] = call %struct.CGRect bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
+// CHECK-NEXT:store %struct.CGRect [[SRC]], %struct.CGRect*
   dataRect = CGRectIsEmpty(virtualBounds) ? self.bounds : virtualBounds;
   dataRect = CGRectIsEmpty(virtualBounds) ? [self bounds] : virtualBounds;
   dataRect = CGRectIsEmpty(virtualBounds) ? virtualBounds : self.bounds;