summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/CodeGen/TargetInfo.cpp17
-rw-r--r--clang/test/CodeGenCXX/dependent-type-member-pointer.cpp1
2 files changed, 6 insertions, 12 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp
index e45195dd261..9a8301617ff 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -2737,18 +2737,11 @@ ABIArgInfo WinX86_64ABIInfo::classify(QualType Ty, bool IsReturnType) const {
}
if (const auto *MPT = Ty->getAs<MemberPointerType>()) {
- // 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/clang/test/CodeGenCXX/dependent-type-member-pointer.cpp b/clang/test/CodeGenCXX/dependent-type-member-pointer.cpp
index 99b8ecd555c..595eca5aab2 100644
--- a/clang/test/CodeGenCXX/dependent-type-member-pointer.cpp
+++ b/clang/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
OpenPOWER on IntegriCloud