mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-03 12:46:07 +00:00
Use a proper lvalue-to-rvalue conversion in Objective-C++ property accessors.
Previously, the synthesized AST contained an rvalue DeclRefExpr for 'self'. Now, it has an lvalue DeclRefExpr wrapped in an lvalue-to-rvalue ImplicitCastExpr, which is what's generated when an ivar access is written in the source. No (intended) functionality change. llvm-svn: 199225
This commit is contained in:
parent
b183f8594f
commit
31c05a117a
@ -1148,12 +1148,15 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
|
|||||||
ImplicitParamDecl *SelfDecl = getterMethod->getSelfDecl();
|
ImplicitParamDecl *SelfDecl = getterMethod->getSelfDecl();
|
||||||
DeclRefExpr *SelfExpr =
|
DeclRefExpr *SelfExpr =
|
||||||
new (Context) DeclRefExpr(SelfDecl, false, SelfDecl->getType(),
|
new (Context) DeclRefExpr(SelfDecl, false, SelfDecl->getType(),
|
||||||
VK_RValue, PropertyDiagLoc);
|
VK_LValue, PropertyDiagLoc);
|
||||||
MarkDeclRefReferenced(SelfExpr);
|
MarkDeclRefReferenced(SelfExpr);
|
||||||
|
Expr *LoadSelfExpr =
|
||||||
|
ImplicitCastExpr::Create(Context, SelfDecl->getType(),
|
||||||
|
CK_LValueToRValue, SelfExpr, 0, VK_RValue);
|
||||||
Expr *IvarRefExpr =
|
Expr *IvarRefExpr =
|
||||||
new (Context) ObjCIvarRefExpr(Ivar, Ivar->getType(), PropertyDiagLoc,
|
new (Context) ObjCIvarRefExpr(Ivar, Ivar->getType(), PropertyDiagLoc,
|
||||||
Ivar->getLocation(),
|
Ivar->getLocation(),
|
||||||
SelfExpr, true, true);
|
LoadSelfExpr, true, true);
|
||||||
ExprResult Res =
|
ExprResult Res =
|
||||||
PerformCopyInitialization(InitializedEntity::InitializeResult(
|
PerformCopyInitialization(InitializedEntity::InitializeResult(
|
||||||
PropertyDiagLoc,
|
PropertyDiagLoc,
|
||||||
@ -1196,12 +1199,15 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
|
|||||||
ImplicitParamDecl *SelfDecl = setterMethod->getSelfDecl();
|
ImplicitParamDecl *SelfDecl = setterMethod->getSelfDecl();
|
||||||
DeclRefExpr *SelfExpr =
|
DeclRefExpr *SelfExpr =
|
||||||
new (Context) DeclRefExpr(SelfDecl, false, SelfDecl->getType(),
|
new (Context) DeclRefExpr(SelfDecl, false, SelfDecl->getType(),
|
||||||
VK_RValue, PropertyDiagLoc);
|
VK_LValue, PropertyDiagLoc);
|
||||||
MarkDeclRefReferenced(SelfExpr);
|
MarkDeclRefReferenced(SelfExpr);
|
||||||
|
Expr *LoadSelfExpr =
|
||||||
|
ImplicitCastExpr::Create(Context, SelfDecl->getType(),
|
||||||
|
CK_LValueToRValue, SelfExpr, 0, VK_RValue);
|
||||||
Expr *lhs =
|
Expr *lhs =
|
||||||
new (Context) ObjCIvarRefExpr(Ivar, Ivar->getType(), PropertyDiagLoc,
|
new (Context) ObjCIvarRefExpr(Ivar, Ivar->getType(), PropertyDiagLoc,
|
||||||
Ivar->getLocation(),
|
Ivar->getLocation(),
|
||||||
SelfExpr, true, true);
|
LoadSelfExpr, true, true);
|
||||||
ObjCMethodDecl::param_iterator P = setterMethod->param_begin();
|
ObjCMethodDecl::param_iterator P = setterMethod->param_begin();
|
||||||
ParmVarDecl *Param = (*P);
|
ParmVarDecl *Param = (*P);
|
||||||
QualType T = Param->getType().getNonReferenceType();
|
QualType T = Param->getType().getNonReferenceType();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user