How can I print to a string in LLVM

╄→гoц情女王★ 提交于 2019-12-30 04:46:05

问题


I want to print an instruction in LLVM to a string instead of the screen. I use I->print( errs() ) to print to the screen. How can I instead put the instruction in a string?


回答1:


Like this,

std::string str;
llvm::raw_string_ostream rso(str);
I->print(rso);


来源:https://stackoverflow.com/questions/13515844/how-can-i-print-to-a-string-in-llvm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!