[llvm] r270877 - Init member structs in constructor.

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 10:39:27 PDT 2016


For one of the structs. MaxGridSize.x depends on constructor's parameter,
so I can't init it statically.

On Thu, May 26, 2016 at 10:37 AM, David Blaikie <dblaikie at gmail.com> wrote:

> You might be able to do it in a non-static data member initializer
> instead, btw. Just initialize it where the member variable is declared.
>
> On Thu, May 26, 2016 at 10:29 AM, Artem Belevich via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: tra
>> Date: Thu May 26 12:29:20 2016
>> New Revision: 270877
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=270877&view=rev
>> Log:
>> Init member structs in constructor.
>>
>> Fixes build error on windows where MSVC does not
>> support list initialization inside member initializer list.
>>
>> Modified:
>>     llvm/trunk/lib/Target/NVPTX/NVVMIntrRange.cpp
>>
>> Modified: llvm/trunk/lib/Target/NVPTX/NVVMIntrRange.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVVMIntrRange.cpp?rev=270877&r1=270876&r2=270877&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/Target/NVPTX/NVVMIntrRange.cpp (original)
>> +++ llvm/trunk/lib/Target/NVPTX/NVVMIntrRange.cpp Thu May 26 12:29:20 2016
>> @@ -38,9 +38,15 @@ class NVVMIntrRange : public FunctionPas
>>   public:
>>     static char ID;
>>     NVVMIntrRange() : NVVMIntrRange(NVVMIntrRangeSM) {}
>> -   NVVMIntrRange(unsigned int SmVersion)
>> -       : FunctionPass(ID), MaxBlockSize{1024, 1024, 64},
>> -         MaxGridSize{SmVersion >= 30 ? 0x7fffffffu : 0xffffu, 0xffff,
>> 0xffff} {
>> +   NVVMIntrRange(unsigned int SmVersion) : FunctionPass(ID) {
>> +     MaxBlockSize.x = 1024;
>> +     MaxBlockSize.y = 1024;
>> +     MaxBlockSize.z = 64;
>> +
>> +     MaxGridSize.x = SmVersion >= 30 ? 0x7fffffff : 0xffff;
>> +     MaxGridSize.y = 0xffff;
>> +     MaxGridSize.z = 0xffff;
>> +
>>       initializeNVVMIntrRangePass(*PassRegistry::getPassRegistry());
>>     }
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
>


-- 
--Artem Belevich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160526/13b521d8/attachment.html>


More information about the llvm-commits mailing list