[cfe-commits] r86407 - in /cfe/trunk/lib/CodeGen: CGExpr.cpp CodeGenFunction.h

Anders Carlsson andersca at mac.com
Sat Nov 7 14:00:15 PST 2009


Author: andersca
Date: Sat Nov  7 16:00:15 2009
New Revision: 86407

URL: http://llvm.org/viewvc/llvm-project?rev=86407&view=rev
Log:
Change EmitPointerToDataMemberLValue to take a FieldDecl. No intended functionality change.

Modified:
    cfe/trunk/lib/CodeGen/CGExpr.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=86407&r1=86406&r2=86407&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Sat Nov  7 16:00:15 2009
@@ -884,7 +884,7 @@
   
   if (E->getQualifier()) {
     // FIXME: the qualifier check does not seem sufficient here
-    return EmitPointerToDataMemberLValue(E);
+    return EmitPointerToDataMemberLValue(cast<FieldDecl>(E->getDecl()));
   }
   
   assert(0 && "Unimp declref");
@@ -1526,8 +1526,7 @@
 }
 
 
-LValue CodeGenFunction::EmitPointerToDataMemberLValue(const DeclRefExpr *E) {
-  const FieldDecl *Field = cast<FieldDecl>(E->getDecl());
+LValue CodeGenFunction::EmitPointerToDataMemberLValue(const FieldDecl *Field) {
   const CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(Field->getDeclContext());
   QualType NNSpecTy = 
     getContext().getCanonicalType(
@@ -1538,7 +1537,7 @@
                                        /*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,

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=86407&r1=86406&r2=86407&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Sat Nov  7 16:00:15 2009
@@ -831,7 +831,8 @@
   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);





More information about the cfe-commits mailing list