[llvm-commits] patch: use CallbackVH for metadata

Nick Lewycky nicholas at mxc.ca
Sat May 9 11:41:12 PDT 2009


Chris Lattner wrote:
> On May 5, 2009, at 11:15 PM, Nick Lewycky wrote:
> 
>> This patch switches MDNode to using CallbackVH and adds a special  
>> typeless "null" keyword that means "(Value*)0" within a metadata  
>> node. Also change MDNode construction to accept Value* even though  
>> we don't really permit non-Constant values yet.
> 
> Looks nice.  Please split MDNode (and the VH.h #include) out to a new  
> MDNode.h file.

Done. I've attached the updated patch. Okay to commit?

> In ElementVH, what is the right behavior when RAUW and delete are  
> called?  Shouldn't these go back through to be recursively uniqued,  
> like what happens for Constants?

The comment block on MDNode says so. ElementVH's delete and RAUW 
implementations call MDNode::replaceElement which uses MDNode::get to 
find the replacement and uncheckedReplaceAllUsesWith to affect it. You 
can see that it works from the last two tests in MetadataTest.

Nick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: metadata-callbackvh2.patch
Type: text/x-diff
Size: 21322 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090509/817dbefc/attachment.patch>


More information about the llvm-commits mailing list