Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to deal with changes in LLVM metadata.h

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.

like image 522
voidMainReturn Avatar asked Oct 20 '22 13:10

voidMainReturn


1 Answers

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.

like image 162
Paschalis Avatar answered Oct 22 '22 21:10

Paschalis