r207819 - Win64: Use ConvertType instead of checking the MS inheritance

Reid Kleckner reid at kleckner.net
Thu May 1 18:14:59 PDT 2014


Author: rnk
Date: Thu May  1 20:14:59 2014
New Revision: 207819

URL: http://llvm.org/viewvc/llvm-project?rev=207819&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/CodeGen/TargetInfo.cpp
    cfe/trunk/test/CodeGenCXX/dependent-type-member-pointer.cpp

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=207819&r1=207818&r2=207819&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Thu May  1 20:14:59 2014
@@ -2737,18 +2737,11 @@ ABIArgInfo WinX86_64ABIInfo::classify(Qu
   }
 
   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()) {

Modified: cfe/trunk/test/CodeGenCXX/dependent-type-member-pointer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/dependent-type-member-pointer.cpp?rev=207819&r1=207818&r2=207819&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/dependent-type-member-pointer.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/dependent-type-member-pointer.cpp Thu May  1 20:14:59 2014
@@ -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
 





More information about the cfe-commits mailing list