From e9fd7eb6c67676dc27e84eac429aec4f3be51f26 Mon Sep 17 00:00:00 2001 From: John McCall Date: Sun, 22 Aug 2010 08:30:07 +0000 Subject: Extract member function pointer comparison and null comparison into the ABI code. Implement correct semantics for these on ARM. I believe this completes the implementation of member function pointers on ARM. I think I'm going to switch member function pointers over to be non-aggregates while I have all this in mind. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111774 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index cbe19825f9..753af76bf2 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -69,17 +69,9 @@ llvm::Value *CodeGenFunction::EvaluateExprAsBool(const Expr *E) { if (E->getType()->isMemberFunctionPointerType()) { LValue LV = EmitAggExprToLValue(E); - // Get the pointer. - llvm::Value *FuncPtr = Builder.CreateStructGEP(LV.getAddress(), 0, - "src.ptr"); - FuncPtr = Builder.CreateLoad(FuncPtr); - - llvm::Value *IsNotNull = - Builder.CreateICmpNE(FuncPtr, - llvm::Constant::getNullValue(FuncPtr->getType()), - "tobool"); - - return IsNotNull; + return CGM.getCXXABI().EmitMemberFunctionPointerIsNotNull(CGF, + LV.getAddress(), + E->getType()->getAs()); } if (!E->getType()->isAnyComplexType()) return EmitScalarConversion(EmitScalarExpr(E), E->getType(), BoolTy); -- cgit v1.2.3