r233023 - MS ABI: lambda call operators are instance methods and should use thiscall

Aaron Ballman aaron at aaronballman.com
Tue Mar 24 06:54:00 PDT 2015


I've reverted in 233082 to get the bots back to green.

~Aaron

On Mon, Mar 23, 2015 at 9:10 PM, NAKAMURA Takumi <geek4civic at gmail.com> wrote:
> You should fix for targeting Win32 x86. See also;
> http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/572
>
> 2015-03-24 6:16 GMT+09:00 Reid Kleckner <reid at kleckner.net>:
>> Author: rnk
>> Date: Mon Mar 23 16:16:49 2015
>> New Revision: 233023
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=233023&view=rev
>> Log:
>> MS ABI: lambda call operators are instance methods and should use thiscall
>>
>> Fixes an issue reported by Daniel Berenyi on cfe-dev.
>>
>> Modified:
>>     cfe/trunk/lib/Sema/SemaType.cpp
>>     cfe/trunk/test/CodeGenCXX/mangle-ms-cxx14.cpp
>>     cfe/trunk/test/SemaCXX/decl-microsoft-call-conv.cpp
>>
>> Modified: cfe/trunk/lib/Sema/SemaType.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=233023&r1=233022&r2=233023&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaType.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaType.cpp Mon Mar 23 16:16:49 2015
>> @@ -2483,6 +2483,10 @@ getCCForDeclaratorChunk(Sema &S, Declara
>>        // in a member pointer.
>>        IsCXXInstanceMethod =
>>            D.getTypeObject(I).Kind == DeclaratorChunk::MemberPointer;
>> +    } else if (D.getContext() == Declarator::LambdaExprContext) {
>> +      // This can only be a call operator for a lambda, which is an instance
>> +      // method.
>> +      IsCXXInstanceMethod = true;
>>      } else {
>>        // We're the innermost decl chunk, so must be a function declarator.
>>        assert(D.isFunctionDeclarator());
>>
>> Modified: cfe/trunk/test/CodeGenCXX/mangle-ms-cxx14.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms-cxx14.cpp?rev=233023&r1=233022&r2=233023&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/CodeGenCXX/mangle-ms-cxx14.cpp (original)
>> +++ cfe/trunk/test/CodeGenCXX/mangle-ms-cxx14.cpp Mon Mar 23 16:16:49 2015
>> @@ -35,10 +35,10 @@ auto TemplateFuncionWithLocalLambda(T) {
>>    return LocalLambdaWithLocalType();
>>  }
>>
>> -// MSVC2013-DAG: "\01?ValueFromTemplateFuncionWithLocalLambda@@3ULocalType@?2???R<lambda_1>@??$TemplateFuncionWithLocalLambda at H@@YA?A?<auto>@@H at Z@QBA?A?3 at XZ@A"
>> -// MSVC2013-DAG: "\01?ValueFromTemplateFuncionWithLocalLambda@@3ULocalType@?2???R<lambda_1>@??$TemplateFuncionWithLocalLambda at H@@YA?A?<auto>@@H at Z@QBA?A?3 at XZ@A"
>> -// MSVC2015-DAG: "\01?ValueFromTemplateFuncionWithLocalLambda@@3ULocalType@?1???R<lambda_1>@??$TemplateFuncionWithLocalLambda at H@@YA?A?<auto>@@H at Z@QBA?A?3 at XZ@A"
>> -// MSVC2015-DAG: "\01?ValueFromTemplateFuncionWithLocalLambda@@3ULocalType@?1???R<lambda_1>@??$TemplateFuncionWithLocalLambda at H@@YA?A?<auto>@@H at Z@QBA?A?3 at XZ@A"
>> +// MSVC2013-DAG: "\01?ValueFromTemplateFuncionWithLocalLambda@@3ULocalType@?2???R<lambda_1>@??$TemplateFuncionWithLocalLambda at H@@YA?A?<auto>@@H at Z@QBE?A?3 at XZ@A"
>> +// MSVC2013-DAG: "\01?ValueFromTemplateFuncionWithLocalLambda@@3ULocalType@?2???R<lambda_1>@??$TemplateFuncionWithLocalLambda at H@@YA?A?<auto>@@H at Z@QBE?A?3 at XZ@A"
>> +// MSVC2015-DAG: "\01?ValueFromTemplateFuncionWithLocalLambda@@3ULocalType@?1???R<lambda_1>@??$TemplateFuncionWithLocalLambda at H@@YA?A?<auto>@@H at Z@QBE?A?3 at XZ@A"
>> +// MSVC2015-DAG: "\01?ValueFromTemplateFuncionWithLocalLambda@@3ULocalType@?1???R<lambda_1>@??$TemplateFuncionWithLocalLambda at H@@YA?A?<auto>@@H at Z@QBE?A?3 at XZ@A"
>>  // CHECK: "\01??$TemplateFuncionWithLocalLambda at H@@YA?A?<auto>@@H at Z"
>> -// CHECK: "\01??R<lambda_1>@??$TemplateFuncionWithLocalLambda at H@@YA?A?<auto>@@H at Z@QBA?A?1 at XZ"
>> +// CHECK: "\01??R<lambda_1>@??$TemplateFuncionWithLocalLambda at H@@YA?A?<auto>@@H at Z@QBE?A?1 at XZ"
>>  auto ValueFromTemplateFuncionWithLocalLambda = TemplateFuncionWithLocalLambda(0);
>>
>> Modified: cfe/trunk/test/SemaCXX/decl-microsoft-call-conv.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/decl-microsoft-call-conv.cpp?rev=233023&r1=233022&r2=233023&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/SemaCXX/decl-microsoft-call-conv.cpp (original)
>> +++ cfe/trunk/test/SemaCXX/decl-microsoft-call-conv.cpp Mon Mar 23 16:16:49 2015
>> @@ -1,6 +1,6 @@
>> -// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -verify %s
>> -// RUN: %clang_cc1 -triple i686-pc-mingw32 -verify %s
>> -// RUN: %clang_cc1 -triple i686-pc-mingw32 -fms-extensions -verify %s
>> +// RUN: %clang_cc1 -std=c++14 -triple i686-pc-win32 -fms-extensions -verify %s
>> +// RUN: %clang_cc1 -std=c++14 -triple i686-pc-mingw32 -verify %s
>> +// RUN: %clang_cc1 -std=c++14 -triple i686-pc-mingw32 -fms-extensions -verify %s
>>
>>  typedef void void_fun_t();
>>  typedef void __cdecl cdecl_fun_t();
>> @@ -242,3 +242,19 @@ namespace test8 {
>>      s.f(p); // expected-note {{in instantiation of member function 'test8::S<void *>::f' requested here}}
>>    }
>>  }
>> +
>> +namespace test9 {
>> +  // Used to fail when we forgot to make lambda call operators use __thiscall.
>> +  template <typename F>
>> +  decltype(auto) deduce(F f) {
>> +    return &decltype(f)::operator();
>> +  }
>> +  template <typename C, typename R, typename A>
>> +  decltype(auto) signaturehelper(R (C::*f)(A) const) {
>> +    return R();
>> +  }
>> +  void f() {
>> +    auto l = [](int x) { return x * 2; };
>> +    decltype(signaturehelper(deduce(l))) p;
>> +  }
>> +}
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list