[cfe-commits] r128554 - in /cfe/trunk: lib/Sema/SemaExpr.cpp lib/Sema/SemaObjCProperty.cpp test/SemaObjCXX/property-reference.mm
Fariborz Jahanian
fjahanian at apple.com
Wed Mar 30 09:59:30 PDT 2011
Author: fjahanian
Date: Wed Mar 30 11:59:30 2011
New Revision: 128554
URL: http://llvm.org/viewvc/llvm-project?rev=128554&view=rev
Log:
de-sugared when accessing property reference type.
Add a test case for synthesize ivar. // rdar://9070460
Added:
cfe/trunk/test/SemaObjCXX/property-reference.mm
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=128554&r1=128553&r2=128554&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Mar 30 11:59:30 2011
@@ -7421,7 +7421,7 @@
ObjCPropertyDecl *PDecl = PropExpr->getExplicitProperty();
QualType T = PDecl->getType();
if (T->isReferenceType())
- T = cast<ReferenceType>(T)->getPointeeType();
+ T = T->getAs<ReferenceType>()->getPointeeType();
CanQualType CT = S.Context.getCanonicalType(T);
return CT.isConstQualified();
}
Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=128554&r1=128553&r2=128554&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Wed Mar 30 11:59:30 2011
@@ -540,7 +540,7 @@
ParmVarDecl *Param = (*P);
QualType T = Param->getType();
if (T->isReferenceType())
- T = cast<ReferenceType>(T)->getPointeeType();
+ T = T->getAs<ReferenceType>()->getPointeeType();
Expr *rhs = new (Context) DeclRefExpr(Param, T,
VK_LValue, SourceLocation());
ExprResult Res = BuildBinOp(S, lhs->getLocEnd(),
Added: cfe/trunk/test/SemaObjCXX/property-reference.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/property-reference.mm?rev=128554&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjCXX/property-reference.mm (added)
+++ cfe/trunk/test/SemaObjCXX/property-reference.mm Wed Mar 30 11:59:30 2011
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fsyntax-only -verify -fobjc-nonfragile-abi %s
+// rdar://9070460
+
+class TCPPObject
+{
+public:
+ TCPPObject(const TCPPObject& inObj);
+ TCPPObject();
+ ~TCPPObject();
+
+ TCPPObject& operator=(const TCPPObject& inObj)const ;
+
+ void* Data();
+
+private:
+ void* fData;
+};
+
+
+typedef const TCPPObject& CREF_TCPPObject;
+
+ at interface TNSObject
+ at property (assign, readwrite, nonatomic) CREF_TCPPObject cppObjectNonAtomic;
+ at property (assign, readwrite) CREF_TCPPObject cppObjectAtomic;
+ at property (assign, readwrite, nonatomic) const TCPPObject& cppObjectDynamic;
+ at end
+
+
+ at implementation TNSObject
+
+ at synthesize cppObjectNonAtomic;
+ at synthesize cppObjectAtomic;
+ at dynamic cppObjectDynamic;
+
+- (const TCPPObject&) cppObjectNonAtomic
+{
+ return cppObjectNonAtomic;
+}
+
+- (void) setCppObjectNonAtomic: (const TCPPObject&)cppObject
+{
+ cppObjectNonAtomic = cppObject;
+}
+ at end
More information about the cfe-commits
mailing list