From: Reid Kleckner Date: Fri, 2 May 2014 01:14:59 +0000 (+0000) Subject: Win64: Use ConvertType instead of checking the MS inheritance X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2336f58e882c77e0011d6c38b95d128273e7f777;p=clang Win64: Use ConvertType instead of checking the MS inheritance dependent-type-member-pointer.cpp is failing on a win64 bot because -fms-extensions is not enabled. Use ConvertType rather than relying on the inheritance attributes. It's less code, but probably slower. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207819 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index e45195dd26..9a8301617f 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -2737,18 +2737,11 @@ ABIArgInfo WinX86_64ABIInfo::classify(QualType Ty, bool IsReturnType) const { } if (const auto *MPT = Ty->getAs()) { - // If the member pointer is not an aggregate, pass it directly. - if (getTarget().getCXXABI().isMicrosoft()) { - // For Microsoft, check with the inheritance model. - const CXXRecordDecl *RD = MPT->getClass()->getAsCXXRecordDecl(); - if (MSInheritanceAttr::hasOnlyOneField(MPT->isMemberFunctionPointer(), - RD->getMSInheritanceModel())) - return ABIArgInfo::getDirect(); - } else { - // For Itanium, data pointers are simple and function pointers are big. - if (MPT->isMemberDataPointer()) - return ABIArgInfo::getDirect(); - } + // If the member pointer is represented by an LLVM int or ptr, pass it + // directly. + llvm::Type *LLTy = CGT.ConvertType(Ty); + if (LLTy->isPointerTy() || LLTy->isIntegerTy()) + return ABIArgInfo::getDirect(); } if (RT || Ty->isMemberPointerType()) { diff --git a/test/CodeGenCXX/dependent-type-member-pointer.cpp b/test/CodeGenCXX/dependent-type-member-pointer.cpp index 99b8ecd555..595eca5aab 100644 --- a/test/CodeGenCXX/dependent-type-member-pointer.cpp +++ b/test/CodeGenCXX/dependent-type-member-pointer.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -emit-llvm-only -verify %s +// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -emit-llvm-only -verify %s // expected-no-diagnostics // PR7736