From 5fd33e0d1a5e3b1611a9dd33cb1acd9b60a74c34 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 24 Apr 2015 01:25:08 +0000 Subject: [PATCH] Replace getPointeeType()->isFunctionType with isMemberDataPointerType llvm-svn: 235682 --- clang/lib/AST/ItaniumCXXABI.cpp | 2 +- clang/lib/CodeGen/CGDebugInfo.cpp | 2 +- clang/lib/CodeGen/CGExprConstant.cpp | 3 +-- clang/lib/CodeGen/ItaniumCXXABI.cpp | 2 +- clang/lib/Sema/SemaCast.cpp | 4 ++-- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/clang/lib/AST/ItaniumCXXABI.cpp b/clang/lib/AST/ItaniumCXXABI.cpp index 74207820b3a8..7503cbfc9805 100644 --- a/clang/lib/AST/ItaniumCXXABI.cpp +++ b/clang/lib/AST/ItaniumCXXABI.cpp @@ -106,7 +106,7 @@ public: TargetInfo::IntType PtrDiff = Target.getPtrDiffType(0); uint64_t Width = Target.getTypeWidth(PtrDiff); unsigned Align = Target.getTypeAlign(PtrDiff); - if (MPT->getPointeeType()->isFunctionType()) + if (MPT->isMemberFunctionPointer()) Width = 2 * Width; return std::make_pair(Width, Align); } diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index d1920c1b1370..fd45f620dcd4 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1879,7 +1879,7 @@ llvm::MDType *CGDebugInfo::CreateType(const RValueReferenceType *Ty, llvm::MDType *CGDebugInfo::CreateType(const MemberPointerType *Ty, llvm::MDFile *U) { llvm::MDType *ClassType = getOrCreateType(QualType(Ty->getClass(), 0), U); - if (!Ty->getPointeeType()->isFunctionType()) + if (Ty->isMemberDataPointerType()) return DBuilder.createMemberPointerType( getOrCreateType(Ty->getPointeeType(), U), ClassType, CGM.getContext().getTypeSize(Ty)); diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index b1cf99c4ee5a..f94213ac9403 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -1421,8 +1421,7 @@ llvm::Constant *CodeGenModule::EmitNullConstant(QualType T) { return ::EmitNullConstant(*this, RD, /*complete object*/ true); } - assert(T->isMemberPointerType() && "Should only see member pointers here!"); - assert(!T->getAs()->getPointeeType()->isFunctionType() && + assert(T->isMemberDataPointerType() && "Should only see pointers to data members here!"); return getCXXABI().EmitNullMemberPointer(T->castAs()); diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp index eb7ab1dc7ae4..e4e369572f51 100644 --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -865,7 +865,7 @@ bool ItaniumCXXABI::classifyReturnType(CGFunctionInfo &FI) const { /// The Itanium ABI requires non-zero initialization only for data /// member pointers, for which '0' is a valid offset. bool ItaniumCXXABI::isZeroInitializable(const MemberPointerType *MPT) { - return MPT->getPointeeType()->isFunctionType(); + return MPT->isMemberFunctionPointer(); } /// The Itanium ABI always places an offset to the complete object diff --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp index d28a24453e2c..091e77936c1e 100644 --- a/clang/lib/Sema/SemaCast.cpp +++ b/clang/lib/Sema/SemaCast.cpp @@ -1817,8 +1817,8 @@ static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr, // can be explicitly converted to an rvalue of type "pointer to member // of Y of type T2" if T1 and T2 are both function types or both object // types. - if (DestMemPtr->getPointeeType()->isFunctionType() != - SrcMemPtr->getPointeeType()->isFunctionType()) + if (DestMemPtr->isMemberFunctionPointer() != + SrcMemPtr->isMemberFunctionPointer()) return TC_NotApplicable; // C++ 5.2.10p2: The reinterpret_cast operator shall not cast away