r239499 - [MS ABI] Allow memfn pointers with unconvertible types to be formed

Manuel Klimek klimek at google.com
Thu Jun 11 00:57:08 PDT 2015


Reverting this and the next one that builds on it...

On Thu, Jun 11, 2015 at 9:49 AM Manuel Klimek <klimek at google.com> wrote:

> This change breaks a test:
>
> http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/4473/testReport/Clang/CodeGenCXX/microsoft_abi_virtual_member_pointers_cpp/
>
> On Thu, Jun 11, 2015 at 2:29 AM David Majnemer <david.majnemer at gmail.com>
> wrote:
>
>> Author: majnemer
>> Date: Wed Jun 10 19:20:57 2015
>> New Revision: 239499
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=239499&view=rev
>> Log:
>> [MS ABI] Allow memfn pointers with unconvertible types to be formed
>>
>> Remove the restriction which forbade forming pointers to member
>> functions which had parameter types or return types which were not
>> convertible.
>>
>> Modified:
>>     cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
>>     cfe/trunk/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp?rev=239499&r1=239498&r2=239499&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp Wed Jun 10 19:20:57 2015
>> @@ -2423,12 +2423,7 @@ MicrosoftCXXABI::BuildMemberPointer(cons
>>      FirstField = CGM.GetAddrOfFunction(MD, Ty);
>>      FirstField = llvm::ConstantExpr::getBitCast(FirstField,
>> CGM.VoidPtrTy);
>>    } else {
>> -    if (!CGM.getTypes().isFuncTypeConvertible(
>> -            MD->getType()->castAs<FunctionType>())) {
>> -      CGM.ErrorUnsupported(MD, "pointer to virtual member function with "
>> -                               "incomplete return or parameter type");
>> -      FirstField = llvm::Constant::getNullValue(CGM.VoidPtrTy);
>> -    } else if (FPT->getCallConv() == CC_X86FastCall) {
>> +    if (FPT->getCallConv() == CC_X86FastCall) {
>>        CGM.ErrorUnsupported(MD, "pointer to fastcall virtual member
>> function");
>>        FirstField = llvm::Constant::getNullValue(CGM.VoidPtrTy);
>>      } else {
>>
>> Modified:
>> cfe/trunk/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp?rev=239499&r1=239498&r2=239499&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp
>> (original)
>> +++ cfe/trunk/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp
>> Wed Jun 10 19:20:57 2015
>> @@ -1,5 +1,5 @@
>> -// RUN: %clang_cc1 -fno-rtti -emit-llvm -triple=i386-pc-win32 %s -o - |
>> FileCheck %s --check-prefix=CHECK32
>> -// RUN: %clang_cc1 -fno-rtti -emit-llvm -triple=x86_64-pc-win32 %s -o -
>> | FileCheck %s --check-prefix=CHECK64
>> +// RUN: %clang_cc1 -std=c++11 -fno-rtti -emit-llvm -triple=i386-pc-win32
>> %s -o - | FileCheck %s --check-prefix=CHECK32
>> +// RUN: %clang_cc1 -std=c++11 -fno-rtti -emit-llvm
>> -triple=x86_64-pc-win32 %s -o - | FileCheck %s --check-prefix=CHECK64
>>
>>  struct S {
>>    int x, y, z;
>> @@ -13,12 +13,15 @@ struct U {
>>    U(const U &);
>>  };
>>
>> +struct B;
>> +
>>  struct C {
>>    virtual void foo();
>>    virtual int bar(int, double);
>>    virtual S baz(int);
>>    virtual S qux(U);
>>    virtual void thud(...);
>> +  virtual void (B::*plugh())();
>>  };
>>
>>  namespace {
>> @@ -47,6 +50,8 @@ void f() {
>>    void (C::*ptr6)(...);
>>    ptr6 = &C::thud;
>>
>> +  auto ptr7 = &C::plugh;
>> +
>>
>>  // CHECK32-LABEL: define void @"\01?f@@YAXXZ"()
>>  // CHECK32: store i8* bitcast (void (%struct.C*, ...)* @"\01??_9C@
>> @$BA at AE" to i8*), i8** %ptr
>> @@ -165,6 +170,20 @@ void f() {
>>  // CHECK64: [[CALLEE:%.*]] = load void (%struct.C*, ...)*, void
>> (%struct.C*, ...)** [[VPTR]]
>>  // CHECK64: musttail call void (%struct.C*, ...) [[CALLEE]](%struct.C*
>> %{{.*}}, ...)
>>  // CHECK64: ret void
>> +// CHECK64: }
>> +
>> +// CHECK32: define linkonce_odr x86_thiscallcc void @"\01??_9C@@$BBE at AE"(%struct.C*
>> %this, ...) {{.*}} comdat align 2 {
>> +// CHECK32: [[VPTR:%.*]] = getelementptr inbounds void (%struct.C*,
>> ...)*, void (%struct.C*, ...)** %vtable, i64 5
>> +// CHECK32: [[CALLEE:%.*]] = load void (%struct.C*, ...)*, void
>> (%struct.C*, ...)** [[VPTR]]
>> +// CHECK32: musttail call x86_thiscallcc void (%struct.C*, ...)
>> [[CALLEE]](%struct.C* %{{.*}}, ...)
>> +// CHECK32: ret void
>> +// CHECK32: }
>> +
>> +// CHECK64: define linkonce_odr void @"\01??_9C@@$BCI at AA"(%struct.C*
>> %this, ...) {{.*}} comdat align 2 {
>> +// CHECK64: [[VPTR:%.*]] = getelementptr inbounds void (%struct.C*,
>> ...)*, void (%struct.C*, ...)** %vtable, i64 5
>> +// CHECK64: [[CALLEE:%.*]] = load void (%struct.C*, ...)*, void
>> (%struct.C*, ...)** [[VPTR]]
>> +// CHECK64: musttail call void (%struct.C*, ...) [[CALLEE]](%struct.C*
>> %{{.*}}, ...)
>> +// CHECK64: ret void
>>  // CHECK64: }
>>
>>  // CHECK32: #[[ATTR]] = {{{.*}}"thunk"{{.*}}}
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150611/ca076a88/attachment.html>


More information about the cfe-commits mailing list