de-sugared when accessing property reference type.

Add a test case for synthesize ivar. // rdar://9070460


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128554 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Fariborz Jahanian 2011-03-30 16:59:30 +00:00
Родитель 68af13f3ca
Коммит 61750f2bed
3 изменённых файлов: 46 добавлений и 2 удалений

Просмотреть файл

@ -7421,7 +7421,7 @@ static bool IsConstProperty(Expr *E, Sema &S) {
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();
}

Просмотреть файл

@ -540,7 +540,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
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(),

Просмотреть файл

@ -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;
@interface TNSObject
@property (assign, readwrite, nonatomic) CREF_TCPPObject cppObjectNonAtomic;
@property (assign, readwrite) CREF_TCPPObject cppObjectAtomic;
@property (assign, readwrite, nonatomic) const TCPPObject& cppObjectDynamic;
@end
@implementation TNSObject
@synthesize cppObjectNonAtomic;
@synthesize cppObjectAtomic;
@dynamic cppObjectDynamic;
- (const TCPPObject&) cppObjectNonAtomic
{
return cppObjectNonAtomic;
}
- (void) setCppObjectNonAtomic: (const TCPPObject&)cppObject
{
cppObjectNonAtomic = cppObject;
}
@end