[llvm] r221454 - Fixing some -Wcast-qual warnings; NFC.

Aaron Ballman aaron at aaronballman.com
Thu Nov 6 08:29:17 PST 2014


On Thu, Nov 6, 2014 at 11:26 AM, David Blaikie <dblaikie at gmail.com> wrote:
>
>
> On Thu, Nov 6, 2014 at 6:32 AM, Aaron Ballman <aaron at aaronballman.com>
> wrote:
>>
>> Author: aaronballman
>> Date: Thu Nov  6 08:32:30 2014
>> New Revision: 221454
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=221454&view=rev
>> Log:
>> Fixing some -Wcast-qual warnings; NFC.
>>
>> Modified:
>>     llvm/trunk/lib/Target/NVPTX/NVPTXLowerStructArgs.cpp
>>
>> Modified: llvm/trunk/lib/Target/NVPTX/NVPTXLowerStructArgs.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXLowerStructArgs.cpp?rev=221454&r1=221453&r2=221454&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/Target/NVPTX/NVPTXLowerStructArgs.cpp (original)
>> +++ llvm/trunk/lib/Target/NVPTX/NVPTXLowerStructArgs.cpp Thu Nov  6
>> 08:32:30 2014
>> @@ -64,7 +64,7 @@ void NVPTXLowerStructArgs::handleParam(A
>>    const Type *StructType = PType->getElementType();
>>
>>    AllocaInst *AllocA =
>> -    new AllocaInst((Type *)StructType, Arg->getName(), FirstInst);
>> +    new AllocaInst(const_cast<Type *>(StructType), Arg->getName(),
>> FirstInst);
>
>
> Why is StructType a const Type* anyway? Types are immutable and we (I)
> removed const from all references to them years ago...

Not entirely certain (not code that I wrote). I would usually guess
"force of habit const-correctness", but the C-style casting away of
constness suggests otherwise. ;-)

~Aaron



More information about the llvm-commits mailing list