mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 12:26:52 +08:00
de-sugared when accessing property reference type.
Add a test case for synthesize ivar. // rdar://9070460 llvm-svn: 128554
This commit is contained in:
@@ -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(),
|
||||
|
||||
44
clang/test/SemaObjCXX/property-reference.mm
Normal file
44
clang/test/SemaObjCXX/property-reference.mm
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user