[llvm-commits] [llvm] r62236 -/llvm/trunk/lib/VMCore/AsmWriter.cpp

Nuno Lopes nunoplopes at sapo.pt
Wed Jan 14 12:17:24 PST 2009


> On Jan 14, 2009, at 9:51 AM, Nuno Lopes wrote:
>
>> Author: nlopes
>> Date: Wed Jan 14 11:51:41 2009
>> New Revision: 62236
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=62236&view=rev
>> Log:
>> fix crash in the case when some arg is null
>
> Hi Nuno,
>
> When can operands be null?
>
> -Chris

There are some passes that nullify the args when doing cleanups. This check 
really helps when you're debuging and call dump(). This way it won't crash 
the app.
IMHO, it doesn't hurt much and helps when debugging (anyway the 
writeOperand() code does the same).

Nuno


>> Modified:
>>    llvm/trunk/lib/VMCore/AsmWriter.cpp
>>
>> Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=62236&r1=62235&r2=62236&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> ======================================================================
>> --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
>> +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Wed Jan 14 11:51:41 2009
>> @@ -1671,7 +1671,7 @@
>>     } else {
>>       for (unsigned i = 1, E = I.getNumOperands(); i != E; ++i) {
>>         Operand = I.getOperand(i);
>> -        if (Operand->getType() != TheType) {
>> +        if (Operand && Operand->getType() != TheType) {
>>           PrintAllTypes = true;    // We have differing types!
>> Print them all!
>>           break;
>>         }
>>
>> 




More information about the llvm-commits mailing list