[cfe-commits] r114845 - in /cfe/trunk: clang.xcodeproj/project.pbxproj lib/AST/Expr.cpp test/CodeGenObjCXX/property-object-conditional-exp.mm

Fariborz Jahanian fjahanian at apple.com
Mon Sep 27 10:30:38 PDT 2010


Author: fjahanian
Date: Mon Sep 27 12:30:38 2010
New Revision: 114845

URL: http://llvm.org/viewvc/llvm-project?rev=114845&view=rev
Log:
Copying result of object property reference expression
into a temporary is elidable as well.
(Finishes up radar 8291337).

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

Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=114845&r1=114844&r2=114845&view=diff
==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Mon Sep 27 12:30:38 2010
@@ -2039,7 +2039,6 @@
 			isa = PBXProject;
 			buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
 			compatibilityVersion = "Xcode 2.4";
-			developmentRegion = English;
 			hasScannedForEncodings = 1;
 			knownRegions = (
 				English,

Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=114845&r1=114844&r2=114845&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Mon Sep 27 12:30:38 2010
@@ -1661,7 +1661,12 @@
   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:

Modified: cfe/trunk/test/CodeGenObjCXX/property-object-conditional-exp.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/property-object-conditional-exp.mm?rev=114845&r1=114844&r2=114845&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjCXX/property-object-conditional-exp.mm (original)
+++ cfe/trunk/test/CodeGenObjCXX/property-object-conditional-exp.mm Mon Sep 27 12:30:38 2010
@@ -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 @@
     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;





More information about the cfe-commits mailing list