Hello everyone,<br><br>I am trying to "parse" a part of LLVM IR. More exactly, from <br><br> @.str = private unnamed_addr constant [3 x i8] c"DS\00", section "llvm.metadata"<br><br>I want to get "DS". It is the single place in the whole bytecode from where I can get it. I have :<br>
<br> ...<br> Value *VV = cast<Value>(LD100->getOperand(1)->getOperand(0));<br> errs()<<"\n VV "<<*(VV)<<"\n";<br> RESULT : VV @.str = private unnamed_addr constant [3 x i8] c"DS\00", section "llvm.metadata"<br>
<br> if(VV->getValueID() == Value::GlobalVariableVal){<br> GlobalVariable* FD = cast<GlobalVariable>(VV);<br> Value *VVV = cast<Value>(FD->getOperand(0));<br> errs()<<"\n VVV "<<*(VVV)<<"\n";<br>
RESULT : VVV [3 x i8] c"DS\00"<br><br> if(VVV->getValueID() == Value::ConstantDataArrayVal){<br> ConstantArray *caa = (ConstantArray *)VVV;<br> errs()<<"\n "<<(caa->getNumOperands())<<"\n";<br>
errs()<<"\n "<<*(caa->getType())<<"\n";<br> RESULT : 0<br> [3 x i8]<br> }<br><br><br>From this point, I tried to cast to every `enum llvm::Value::ValueTy` in order to try to iterate through [3 X i8], in order to get "DS" (as a StringRef or std::string would be nice), but I cannot. How I can parse this structure?<br>
<br>Thank you for any help !