From: Anders Carlsson Date: Sat, 7 Nov 2009 22:00:15 +0000 (+0000) Subject: Change EmitPointerToDataMemberLValue to take a FieldDecl. No intended functionality... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=909fbf70223ea04a5ec8d449789f3683a89701ff;p=clang Change EmitPointerToDataMemberLValue to take a FieldDecl. No intended functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86407 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index d9dd70ac9e..62e16e8ba2 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -884,7 +884,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) { if (E->getQualifier()) { // FIXME: the qualifier check does not seem sufficient here - return EmitPointerToDataMemberLValue(E); + return EmitPointerToDataMemberLValue(cast(E->getDecl())); } assert(0 && "Unimp declref"); @@ -1526,8 +1526,7 @@ LValue CodeGenFunction::EmitStmtExprLValue(const StmtExpr *E) { } -LValue CodeGenFunction::EmitPointerToDataMemberLValue(const DeclRefExpr *E) { - const FieldDecl *Field = cast(E->getDecl()); +LValue CodeGenFunction::EmitPointerToDataMemberLValue(const FieldDecl *Field) { const CXXRecordDecl *ClassDecl = cast(Field->getDeclContext()); QualType NNSpecTy = getContext().getCanonicalType( @@ -1538,7 +1537,7 @@ LValue CodeGenFunction::EmitPointerToDataMemberLValue(const DeclRefExpr *E) { /*isUnion*/false, /*Qualifiers*/0); const llvm::Type *ResultType = ConvertType(getContext().getPointerDiffType()); V = Builder.CreatePtrToInt(MemExpLV.getAddress(), ResultType, "datamember"); - return LValue::MakeAddr(V, MakeQualifiers(E->getType())); + return LValue::MakeAddr(V, MakeQualifiers(Field->getType())); } RValue CodeGenFunction::EmitCall(llvm::Value *Callee, QualType CalleeType, diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index 5c592af022..f2901beca4 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -831,7 +831,8 @@ public: LValue EmitConditionalOperatorLValue(const ConditionalOperator *E); LValue EmitCastLValue(const CastExpr *E); LValue EmitNullInitializationLValue(const CXXZeroInitValueExpr *E); - LValue EmitPointerToDataMemberLValue(const DeclRefExpr *E); + + LValue EmitPointerToDataMemberLValue(const FieldDecl *Field); llvm::Value *EmitIvarOffset(const ObjCInterfaceDecl *Interface, const ObjCIvarDecl *Ivar);