Eliminate a stale assertion. Fixes Clang self-host.

llvm-svn: 111782
This commit is contained in:
Douglas Gregor 2010-08-22 18:26:35 +00:00
parent b0a04fff51
commit 932c19dc9f
3 changed files with 19 additions and 4 deletions

View File

@ -897,6 +897,7 @@ public:
bool isFunctionPointerType() const;
bool isMemberPointerType() const;
bool isMemberFunctionPointerType() const;
bool isMemberDataPointerType() const;
bool isArrayType() const;
bool isConstantArrayType() const;
bool isIncompleteArrayType() const;
@ -3486,6 +3487,12 @@ inline bool Type::isMemberFunctionPointerType() const {
else
return false;
}
inline bool Type::isMemberDataPointerType() const {
if (const MemberPointerType* T = getAs<MemberPointerType>())
return !T->getPointeeType()->isFunctionType();
else
return false;
}
inline bool Type::isArrayType() const {
return isa<ArrayType>(CanonicalType);
}

View File

@ -569,12 +569,9 @@ EmitComplexToScalarConversion(CodeGenFunction::ComplexPairTy Src,
Value *ScalarExprEmitter::EmitNullValue(QualType Ty) {
const llvm::Type *LTy = ConvertType(Ty);
if (!Ty->isMemberPointerType())
if (!Ty->isMemberDataPointerType())
return llvm::Constant::getNullValue(LTy);
assert(!Ty->isMemberFunctionPointerType() &&
"member function pointers are not scalar!");
// Itanium C++ ABI 2.3:
// A NULL pointer is represented as -1.
return llvm::ConstantInt::get(LTy, -1ULL, /*isSigned=*/true);

View File

@ -198,3 +198,14 @@ namespace test7 {
void (C::*ptr4)() = &B::vfoo;
void (C::*ptr5)() = &C::vfoo;
}
namespace test8 {
struct X { };
typedef int (X::*pmf)(int);
// CHECK: {{define.*_ZN5test81fEv}}
pmf f() {
// CHECK: {{ret.*zeroinitializer}}
return pmf();
}
}