diff options
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r-- | lib/CodeGen/CGExpr.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 48f69e4ca4..b0e091bd0a 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -993,6 +993,16 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) { if (PTy->getPointeeType()->isUnionType()) isUnion = true; CVRQualifiers = PTy->getPointeeType().getCVRQualifiers(); + if (CXXThisExpr *ThisExpr = dyn_cast<CXXThisExpr>(BaseExpr)) { + QualType ClassTy = ThisExpr->getType(); + ClassTy = ClassTy->getPointeeType(); + CXXRecordDecl *ClassDecl = + cast<CXXRecordDecl>(ClassTy->getAsRecordType()->getDecl()); + FieldDecl *Field = dyn_cast<FieldDecl>(E->getMemberDecl()); + CXXRecordDecl *BaseClassDecl = + cast<CXXRecordDecl>(Field->getDeclContext()); + BaseValue = AddressCXXOfBaseClass(BaseValue, ClassDecl, BaseClassDecl); + } } else if (isa<ObjCPropertyRefExpr>(BaseExpr) || isa<ObjCKVCRefExpr>(BaseExpr)) { RValue RV = EmitObjCPropertyGet(BaseExpr); |