]> granicus.if.org Git - clang/commitdiff
Win64: Use ConvertType instead of checking the MS inheritance
authorReid Kleckner <reid@kleckner.net>
Fri, 2 May 2014 01:14:59 +0000 (01:14 +0000)
committerReid Kleckner <reid@kleckner.net>
Fri, 2 May 2014 01:14:59 +0000 (01:14 +0000)
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

lib/CodeGen/TargetInfo.cpp
test/CodeGenCXX/dependent-type-member-pointer.cpp

index e45195dd261d3bffa43c3b2b3ad5b8ed9068be68..9a8301617ff62710fe3fe021e9ae5298e932dab7 100644 (file)
@@ -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()) {
index 99b8ecd555c79e16241ac635f2708128815918f4..595eca5aab2deb971b8f4ffd1510dd32acf3b453 100644 (file)
@@ -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