[llvm-branch-commits] [cfe-branch] r114159 - in /cfe/branches/Apple/whitney-IB/src/tools/clang: include/clang/Sema/Sema.h lib/AST/ExprClassification.cpp lib/Sema/SemaExpr.cpp test/CodeGenObjCXX/property-dot-copy.mm

Daniel Dunbar daniel at zuster.org
Thu Sep 16 20:36:13 PDT 2010


Author: ddunbar
Date: Thu Sep 16 22:36:13 2010
New Revision: 114159

URL: http://llvm.org/viewvc/llvm-project?rev=114159&view=rev
Log:
--- Reverse-merging r113885 into 'src/tools/clang':
D    src/tools/clang/test/CodeGenObjCXX/property-dot-copy.mm
U    src/tools/clang/include/clang/Sema/Sema.h
U    src/tools/clang/lib/Sema/SemaExpr.cpp
U    src/tools/clang/lib/AST/ExprClassification.cpp


Removed:
    cfe/branches/Apple/whitney-IB/src/tools/clang/test/CodeGenObjCXX/property-dot-copy.mm
Modified:
    cfe/branches/Apple/whitney-IB/src/tools/clang/include/clang/Sema/Sema.h
    cfe/branches/Apple/whitney-IB/src/tools/clang/lib/AST/ExprClassification.cpp
    cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Sema/SemaExpr.cpp

Modified: cfe/branches/Apple/whitney-IB/src/tools/clang/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney-IB/src/tools/clang/include/clang/Sema/Sema.h?rev=114159&r1=114158&r2=114159&view=diff
==============================================================================
--- cfe/branches/Apple/whitney-IB/src/tools/clang/include/clang/Sema/Sema.h (original)
+++ cfe/branches/Apple/whitney-IB/src/tools/clang/include/clang/Sema/Sema.h Thu Sep 16 22:36:13 2010
@@ -4107,9 +4107,6 @@
   // For compound assignment, pass both expressions and the converted type.
   QualType CheckAssignmentOperands( // C99 6.5.16.[1,2]
     Expr *lex, Expr *&rex, SourceLocation OpLoc, QualType convertedType);
-  
-  void ConvertPropertyAssignment(Expr *LHS, Expr *&RHS, QualType& LHSTy);
-                                   
   QualType CheckCommaOperands( // C99 6.5.17
     Expr *lex, Expr *&rex, SourceLocation OpLoc);
   QualType CheckConditionalOperands( // C99 6.5.15

Modified: cfe/branches/Apple/whitney-IB/src/tools/clang/lib/AST/ExprClassification.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney-IB/src/tools/clang/lib/AST/ExprClassification.cpp?rev=114159&r1=114158&r2=114159&view=diff
==============================================================================
--- cfe/branches/Apple/whitney-IB/src/tools/clang/lib/AST/ExprClassification.cpp (original)
+++ cfe/branches/Apple/whitney-IB/src/tools/clang/lib/AST/ExprClassification.cpp Thu Sep 16 22:36:13 2010
@@ -478,8 +478,7 @@
 
   // Records with any const fields (recursively) are not modifiable.
   if (const RecordType *R = CT->getAs<RecordType>()) {
-    assert((isa<ObjCImplicitSetterGetterRefExpr>(E) ||
-            isa<ObjCPropertyRefExpr>(E) ||
+    assert((isa<ObjCImplicitSetterGetterRefExpr>(E) || 
             !Ctx.getLangOptions().CPlusPlus) &&
            "C++ struct assignment should be resolved by the "
            "copy assignment operator.");

Modified: cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Sema/SemaExpr.cpp?rev=114159&r1=114158&r2=114159&view=diff
==============================================================================
--- cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Sema/SemaExpr.cpp (original)
+++ cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Sema/SemaExpr.cpp Thu Sep 16 22:36:13 2010
@@ -6016,7 +6016,17 @@
   if (CompoundType.isNull()) {
     QualType LHSTy(LHSType);
     // Simple assignment "x = y".
-    ConvertPropertyAssignment(LHS, RHS, LHSTy);
+    if (const ObjCImplicitSetterGetterRefExpr *OISGE = 
+        dyn_cast<ObjCImplicitSetterGetterRefExpr>(LHS)) {
+      // If using property-dot syntax notation for assignment, and there is a
+      // setter, RHS expression is being passed to the setter argument. So,
+      // type conversion (and comparison) is RHS to setter's argument type.
+      if (const ObjCMethodDecl *SetterMD = OISGE->getSetterMethod()) {
+        ObjCMethodDecl::param_iterator P = SetterMD->param_begin();
+        LHSTy = (*P)->getType();
+      }
+    }
+    
     ConvTy = CheckSingleAssignmentConstraints(LHSTy, RHS);
     // Special case of NSObject attributes on c-style pointer types.
     if (ConvTy == IncompatiblePointer &&
@@ -6171,34 +6181,6 @@
     ? ResType : ResType.getUnqualifiedType();
 }
 
-void Sema::ConvertPropertyAssignment(Expr *LHS, Expr *&RHS, QualType& LHSTy) {
-  bool copyInit = false;
-  if (const ObjCImplicitSetterGetterRefExpr *OISGE = 
-      dyn_cast<ObjCImplicitSetterGetterRefExpr>(LHS)) {
-    // If using property-dot syntax notation for assignment, and there is a
-    // setter, RHS expression is being passed to the setter argument. So,
-    // type conversion (and comparison) is RHS to setter's argument type.
-    if (const ObjCMethodDecl *SetterMD = OISGE->getSetterMethod()) {
-      ObjCMethodDecl::param_iterator P = SetterMD->param_begin();
-      LHSTy = (*P)->getType();
-    }
-    copyInit = (getLangOptions().CPlusPlus && LHSTy->isRecordType());
-  } 
-  else 
-      copyInit = (getLangOptions().CPlusPlus && isa<ObjCPropertyRefExpr>(LHS) &&
-                  LHSTy->isRecordType());
-  if (copyInit) {
-    InitializedEntity Entity = 
-    InitializedEntity::InitializeParameter(LHSTy);
-    Expr *Arg = RHS;
-    ExprResult ArgE = PerformCopyInitialization(Entity, SourceLocation(),
-                                                Owned(Arg));
-    if (!ArgE.isInvalid())
-      RHS = ArgE.takeAs<Expr>();
-  }
-}
-  
-
 /// getPrimaryDecl - Helper function for CheckAddressOfOperand().
 /// This routine allows us to typecheck complex/recursive expressions
 /// where the declaration is needed for type checking. We only need to
@@ -6716,9 +6698,8 @@
                             BinaryOperatorKind Opc,
                             Expr *lhs, Expr *rhs) {
   if (getLangOptions().CPlusPlus &&
-      ((!isa<ObjCImplicitSetterGetterRefExpr>(lhs) && 
-        !isa<ObjCPropertyRefExpr>(lhs))
-        || rhs->isTypeDependent()) &&
+      (!isa<ObjCImplicitSetterGetterRefExpr>(lhs) ||
+       rhs->isTypeDependent()) &&
       (lhs->getType()->isOverloadableType() ||
        rhs->getType()->isOverloadableType())) {
     // Find all of the overloaded operators visible from this

Removed: cfe/branches/Apple/whitney-IB/src/tools/clang/test/CodeGenObjCXX/property-dot-copy.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney-IB/src/tools/clang/test/CodeGenObjCXX/property-dot-copy.mm?rev=114158&view=auto
==============================================================================
--- cfe/branches/Apple/whitney-IB/src/tools/clang/test/CodeGenObjCXX/property-dot-copy.mm (original)
+++ cfe/branches/Apple/whitney-IB/src/tools/clang/test/CodeGenObjCXX/property-dot-copy.mm (removed)
@@ -1,34 +0,0 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -o - %s | FileCheck %s
-// rdar://8427922
-
-struct Vector3D
-{
-		float x, y, z;
-		Vector3D();
-		Vector3D(const Vector3D &inVector);
-		Vector3D(float initX, float initY, float initZ);
-		Vector3D &operator=(const Vector3D & rhs);
-};
-
- at interface Object3D
-{
-	Vector3D position;
-        Vector3D length;
-}
- at property (assign) Vector3D position;
-- (Vector3D) length;
-- (void) setLength: (Vector3D)arg;
- at end
-
-int main () 
-{
-	Object3D *myObject;
-        Vector3D V3D(1.0f, 1.0f, 1.0f);
-// CHECK: call void @_ZN8Vector3DC1ERKS_
-	myObject.position = V3D;
-
-// CHECK: call void @_ZN8Vector3DC1ERKS_
-	myObject.length = V3D;
-
-        return 0;
-}





More information about the llvm-branch-commits mailing list