如何在LLVM中打印为字符串 [英] How can I print to a string in LLVM

查看:119
本文介绍了如何在LLVM中打印为字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将LLVM中的指令打印为字符串而不是屏幕.我使用I->print( errs() )打印到屏幕上.我该如何将指令放在字符串中?

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?

推荐答案

喜欢这个

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

这篇关于如何在LLVM中打印为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆