[cfe-commits] r98848 - in /cfe/trunk: include/clang/AST/Expr.h include/clang/Basic/DiagnosticSemaKinds.td lib/AST/Expr.cpp lib/Sema/SemaExpr.cpp test/SemaObjC/property-not-lvalue.m
Fariborz Jahanian
fjahanian at apple.com
Thu Mar 18 11:50:41 PDT 2010
Author: fjahanian
Date: Thu Mar 18 13:50:41 2010
New Revision: 98848
URL: http://llvm.org/viewvc/llvm-project?rev=98848&view=rev
Log:
Some cleanup, change diagnostic when assigning to
a property which is not lvalue.
Modified:
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaObjC/property-not-lvalue.m
Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=98848&r1=98847&r2=98848&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Thu Mar 18 13:50:41 2010
@@ -150,7 +150,6 @@
LV_InvalidExpression,
LV_MemberFunction,
LV_SubObjCPropertySetting,
- LV_SubObjCPropertyGetterSetting,
LV_ClassTemporary
};
isLvalueResult isLvalue(ASTContext &Ctx) const;
@@ -182,7 +181,6 @@
MLV_NoSetterProperty,
MLV_MemberFunction,
MLV_SubObjCPropertySetting,
- MLV_SubObjCPropertyGetterSetting,
MLV_ClassTemporary
};
isModifiableLvalueResult isModifiableLvalue(ASTContext &Ctx,
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=98848&r1=98847&r2=98848&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Mar 18 13:50:41 2010
@@ -1952,11 +1952,7 @@
def error_nosetter_property_assignment : Error<
"setter method is needed to assign to object using property" " assignment syntax">;
def error_no_subobject_property_setting : Error<
- "cannot assign to a sub-structure of an ivar using property"
- " assignment syntax">;
-def error_no_subobject_property_getter_setting : Error<
- "cannot assign to a sub-structure returned via a getter using property"
- " assignment syntax">;
+ "expression is not assignable using property assignment syntax">;
def ext_freestanding_complex : Extension<
"complex numbers are an extension in a freestanding C99 implementation">;
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=98848&r1=98847&r2=98848&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Thu Mar 18 13:50:41 2010
@@ -1104,11 +1104,11 @@
if (m->isArrow())
return LV_Valid;
Expr *BaseExp = m->getBase();
- if (BaseExp->getStmtClass() == ObjCPropertyRefExprClass)
+ if (BaseExp->getStmtClass() == ObjCPropertyRefExprClass ||
+ BaseExp->getStmtClass() == ObjCImplicitSetterGetterRefExprClass)
return LV_SubObjCPropertySetting;
return
- (BaseExp->getStmtClass() == ObjCImplicitSetterGetterRefExprClass) ?
- LV_SubObjCPropertyGetterSetting : BaseExp->isLvalue(Ctx);
+ BaseExp->isLvalue(Ctx);
}
case UnaryOperatorClass:
if (cast<UnaryOperator>(this)->getOpcode() == UnaryOperator::Deref)
@@ -1324,8 +1324,6 @@
return MLV_InvalidExpression;
case LV_MemberFunction: return MLV_MemberFunction;
case LV_SubObjCPropertySetting: return MLV_SubObjCPropertySetting;
- case LV_SubObjCPropertyGetterSetting:
- return MLV_SubObjCPropertyGetterSetting;
case LV_ClassTemporary:
return MLV_ClassTemporary;
}
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=98848&r1=98847&r2=98848&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Mar 18 13:50:41 2010
@@ -5790,9 +5790,6 @@
case Expr::MLV_SubObjCPropertySetting:
Diag = diag::error_no_subobject_property_setting;
break;
- case Expr::MLV_SubObjCPropertyGetterSetting:
- Diag = diag::error_no_subobject_property_getter_setting;
- break;
}
SourceRange Assign;
Modified: cfe/trunk/test/SemaObjC/property-not-lvalue.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-not-lvalue.m?rev=98848&r1=98847&r2=98848&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/property-not-lvalue.m (original)
+++ cfe/trunk/test/SemaObjC/property-not-lvalue.m Thu Mar 18 13:50:41 2010
@@ -15,8 +15,8 @@
void foo() {
Foo *f;
- f.size.width = 2.2; // expected-error {{cannot assign to a sub-structure of an ivar using property assignment syntax}}
- f.size.inner.dim = 200; // expected-error {{cannot assign to a sub-structure of an ivar using property assignment syntax}}
+ f.size.width = 2.2; // expected-error {{expression is not assignable using property assignment syntax}}
+ f.size.inner.dim = 200; // expected-error {{expression is not assignable using property assignment syntax}}
}
// radar 7628953
@@ -28,7 +28,7 @@
@implementation Gorf
- (void)MyView_sharedInit {
- self.size.width = 2.2; // expected-error {{cannot assign to a sub-structure returned via a getter using property assignment syntax}}
+ self.size.width = 2.2; // expected-error {{expression is not assignable using property assignment syntax}}
}
- (NSSize)size {}
@end
More information about the cfe-commits
mailing list