Reputation: 3537
In the LLVM version 3.6 they have changed the metadata class a lot and they have split the metadata from value. so my previous code based on 3.5 version doesn't work anymore. I am having difficulties upgrading my code. Can anybody help.
e.g. : previous code :
MDNode *record;
Value *undVal = record->getOperand(1);
Type *type_hint = undVal->getType();
Does anyone know how to upgrade this code to make it 3.6 compatible ?
I tried this :
MDNode *record;
const MDOperand &undVal = record->getOperand(1);
Type *type_hint = undVal->getType();
But it doesn't work. Results in compile errors saying
'getType' : is not a member of 'llvm::Metadata'
Any help is appreciated.
Upvotes: 5
Views: 311
Reputation: 12321
MDNode *record;
Value *undVal = dyn_cast<ValueAsMetadata>(record->getOperand(1))->getValue();
@sadeq suggestion wasn't compiling for me, but was definitely as step in the right direction.
Upvotes: 2
Reputation: 537
Have you tried dyn_cast<>, like this:
Value* undval = dyn_cast<Value>(record->getoperand(1));
Type* type_hint;
if(undval) type_hint = undVal->hetType();
Upvotes: 1