diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2009-10-21 21:01:47 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-10-21 21:01:47 +0000 |
| commit | 39762951ad2abfed7b743c01c672fac85034b856 (patch) | |
| tree | 894adb0316258b2062421cb4c4f8596204c1941f /lib/CodeGen/CGExpr.cpp | |
| parent | 27059c8ef47e29d6af600cee72c0c0b5e4e4c377 (diff) | |
Expand on code gen. for pointer to data members so it works
for base classe members as well. Test case enhanced for this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84780 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
| -rw-r--r-- | lib/CodeGen/CGExpr.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 2266b25c68..0b56fa94b7 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -1519,9 +1519,10 @@ LValue CodeGenFunction::EmitStmtExprLValue(const StmtExpr *E) { LValue CodeGenFunction::EmitPointerToDataMemberLValue( const QualifiedDeclRefExpr *E) { const FieldDecl *Field = cast<FieldDecl>(E->getDecl()); - const NestedNameSpecifier *NNSpec = E->getQualifier(); - const Type *NNSpecType = NNSpec->getAsType(); - QualType NNSpecTy = getContext().getCanonicalType(QualType(NNSpecType, 0)); + const CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(Field->getDeclContext()); + QualType NNSpecTy = + getContext().getCanonicalType( + getContext().getTypeDeclType(const_cast<CXXRecordDecl*>(ClassDecl))); NNSpecTy = getContext().getPointerType(NNSpecTy); llvm::Value *V = llvm::Constant::getNullValue(ConvertType(NNSpecTy)); LValue MemExpLV = EmitLValueForField(V, const_cast<FieldDecl*>(Field), |
