如何使用f.getValuesymboltable()
我想在功能中获取所有本地变量。
void getLocalVariables(Function &F) {
ValueSymbolTable *vst = F.getValueSymbolTable();
for (auto vs : vst) { // here it says: This scope-based "for" statement required the appropriate "begin" function, but was not found
auto s = vs.getKey();
auto v = vs.getValue();
}
}
错误是:基于范围的“对语句需要适当的开始”函数,但没有找到
。所以如何更正我的代码? TKS。
I wanna get all the local variables in a function.
void getLocalVariables(Function &F) {
ValueSymbolTable *vst = F.getValueSymbolTable();
for (auto vs : vst) { // here it says: This scope-based "for" statement required the appropriate "begin" function, but was not found
auto s = vs.getKey();
auto v = vs.getValue();
}
}
The error is that: This scope-based "for" statement required the appropriate "begin" function, but was not found
. So how can I correct my code? Tks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我检查文档是否
valueymboltable
,最后找到如何使用它。但是实际上,正如 arnt 所说,它们不是源代码中的本地变量。它们是IR产生的临时变量。I check the documentation for
ValueSymbolTable
, and finally find how to use it. But actually, as arnt said, they are not local variables in source code. They are temporary variables generated by IR.