getting the value back from metadata


I’m trying to extract the value out of my MDNode, but for some reason I can’t.

For example, if one part of the code gets an MDNode that was created as follows:

Metadata* vals[2] =

{ ValueAsMetadata::get(&F), ValueAsMetadata::get(ConstantInt::get(context, 135)) };

MDNode* mdnode = MDNode::get(context, vals);

You should try mdconst::extract<ConstantInt> instead of cast<ConstantInt> (search in the codebase for example if needed).

Thanks a lot! J