[LLVMdev] [Junk released by Allowed List] Re: Patch: MSIL backend global pointers initialization

Artur Pietrek artur.pietrek at kalray.eu
Mon Apr 6 07:34:14 PDT 2009


Hi Anton,

Anton Korobeynikov wrote:
>> +        if (isa<ConstantExpr>(I->constant)){
>> +          const ConstantExpr *CE =
>> dyn_cast<ConstantExpr>(I->constant);
>> +          printConstantExpr(CE);
>> +          ty = CE->getType();
>> +        } else {
>> +          const Function * F = dyn_cast<Function>(I->constant);
>> +          printValueLoad(F);
>> +          ty = F->getType();
>> +        }
>>     
> You don't need to check stuff twice here.
> 1. Use dyn_cast<ConstantExpr> instead of isa + dyn_cast
> 2. In the "else" path you need to be sure, that I->constant is indeed
> Function. Use cast, not dyn_cast.
>
> PS: Also: "if (foo){" => "if (foo) {"
>   
OK, I've fixed that.

Thanks,
Artur
-------------- next part --------------
A non-text attachment was scrubbed...
Name: globals.patch
Type: text/x-patch
Size: 2727 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090406/449a64fe/attachment.bin>


More information about the llvm-dev mailing list