[llvm] r186985 - Debug Info: code cleanup, use getNodeField if possible.

Manman Ren manman.ren at gmail.com
Tue Jul 23 16:09:34 PDT 2013


On 7/23/13, 2:38 PM, Eric Christopher wrote:
> On Tue, Jul 23, 2013 at 1:39 PM, Manman Ren <manman.ren at gmail.com> wrote:
>> Author: mren
>> Date: Tue Jul 23 15:39:32 2013
>> New Revision: 186985
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=186985&view=rev
>> Log:
>> Debug Info: code cleanup, use getNodeField if possible.
>>
>> Use getNodeField to access a field as a MDNode.
>> No functionality change.
>>
> Nice cleanup. :)
>
>>   DIArray DISubprogram::getVariables() const {
>> -  if (!DbgNode || DbgNode->getNumOperands() <= 18)
>> -    return DIArray();
>> -  if (MDNode *T = dyn_cast_or_null<MDNode>(DbgNode->getOperand(18)))
>> +  if (MDNode *T = getNodeField(DbgNode, 18))
>>       return DIArray(T);
> Should be able to replace this pattern with just
>
> DIArray(getNodeField(DbgNode, 18))
>
> yes and let the null just pass through since that's all the default
> argument to the constructor is doing yes?
You are right. In r187002.

Manman
>
> -eric




More information about the llvm-commits mailing list