aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprAgg.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-08-22 10:59:02 +0000
committerJohn McCall <rjmccall@apple.com>2010-08-22 10:59:02 +0000
commitd608cdb7c044365cf4e8764ade1e11e99c176078 (patch)
tree64048b57b20b73f88b0d6dc576241554929236cf /lib/CodeGen/CGExprAgg.cpp
parente9fd7eb6c67676dc27e84eac429aec4f3be51f26 (diff)
Experiment with using first-class aggregates to represent member function
pointers. I find the resulting code to be substantially cleaner, and it makes it very easy to use the same APIs for data member pointers (which I have conscientiously avoided here), and it avoids a plethora of potential inefficiencies due to excessive memory copying, but we'll have to see if it actually works. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111776 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprAgg.cpp')
-rw-r--r--lib/CodeGen/CGExprAgg.cpp55
1 files changed, 0 insertions, 55 deletions
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp
index b75aeb13b8..890a07f9fb 100644
--- a/lib/CodeGen/CGExprAgg.cpp
+++ b/lib/CodeGen/CGExprAgg.cpp
@@ -108,7 +108,6 @@ public:
void VisitPointerToDataMemberBinaryOperator(const BinaryOperator *BO);
void VisitBinAssign(const BinaryOperator *E);
void VisitBinComma(const BinaryOperator *E);
- void VisitUnaryAddrOf(const UnaryOperator *E);
void VisitObjCMessageExpr(ObjCMessageExpr *E);
void VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
@@ -287,46 +286,9 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) {
Visit(E->getSubExpr());
break;
- case CastExpr::CK_NullToMemberPointer: {
- // If the subexpression's type is the C++0x nullptr_t, emit the
- // subexpression, which may have side effects.
- if (E->getSubExpr()->getType()->isNullPtrType())
- Visit(E->getSubExpr());
-
- CGF.CGM.getCXXABI().EmitNullMemberFunctionPointer(CGF,
- E->getType()->getAs<MemberPointerType>(),
- DestPtr, VolatileDest);
-
- break;
- }
-
case CastExpr::CK_LValueBitCast:
llvm_unreachable("there are no lvalue bit-casts on aggregates");
break;
-
- case CastExpr::CK_BitCast: {
- // This must be a member function pointer cast.
- Visit(E->getSubExpr());
- break;
- }
-
- case CastExpr::CK_DerivedToBaseMemberPointer:
- case CastExpr::CK_BaseToDerivedMemberPointer: {
- QualType SrcType = E->getSubExpr()->getType();
-
- llvm::Value *Src = CGF.CreateMemTemp(SrcType, "tmp");
- CGF.EmitAggExpr(E->getSubExpr(), Src, SrcType.isVolatileQualified());
-
- // Note that the AST doesn't distinguish between checked and
- // unchecked member pointer conversions, so we always have to
- // implement checked conversions here. This is inefficient for
- // ABIs where an actual null check is thus required; fortunately,
- // the Itanium and ARM ABIs ignore the adjustment value when
- // considering null-ness.
- CGF.CGM.getCXXABI().EmitMemberFunctionPointerConversion(CGF, E, Src,
- DestPtr, VolatileDest);
- break;
- }
}
}
@@ -362,23 +324,6 @@ void AggExprEmitter::VisitBinComma(const BinaryOperator *E) {
/*IgnoreResult=*/false, IsInitializer);
}
-void AggExprEmitter::VisitUnaryAddrOf(const UnaryOperator *E) {
- // We have a member function pointer.
- assert(E->getType()->getAs<MemberPointerType>()
- ->getPointeeType()->isFunctionProtoType() &&
- "Unexpected member pointer type!");
-
- // The creation of member function pointers has no side effects; if
- // there is no destination pointer, we have nothing to do.
- if (!DestPtr)
- return;
-
- const DeclRefExpr *DRE = cast<DeclRefExpr>(E->getSubExpr());
- const CXXMethodDecl *MD = cast<CXXMethodDecl>(DRE->getDecl());
-
- CGF.CGM.getCXXABI().EmitMemberFunctionPointer(CGF, MD, DestPtr, VolatileDest);
-}
-
void AggExprEmitter::VisitStmtExpr(const StmtExpr *E) {
CGF.EmitCompoundStmt(*E->getSubStmt(), true, DestPtr, VolatileDest);
}