LLVM,将内部结构的偏移偏移
LLVM, get the offset of inside struct
我想使用LLVM中每个结构元素的细粒偏移。例如:
struct A{
int a;
int b;
};
struct B{
int c;
struct A sa;
};
struct B s;
对于struct B,我想枚举其中的每个元素,即:偏移(s.c)= 0,偏移(s.sa.a)= 4,offset(s.sa.b)= 8。除了dump()?
使用模块:: getDatalayout获取DataLayout对象,该对象可以为您提供StructLayout
作为Datalayout :: getsstructlayout的返回。StructLayout
具有执行您想要的getElementOffset()方法。
相关文章:
- C++ 结构内部的unordered_map会导致内存泄漏问题吗?
- 在C++中更改结构内部元素的方法?
- 结构内部结构的联合 - 混合 C 和 C++
- 如果在结构内部使用condition_variable,则它不起作用
- 尝试将数据添加到结构内部的矢量时出错
- 如何使结构内部的可变参数模板可以在外部访问?
- 结构内部的结构:"对非静态成员的非法引用"错误
- C 是什么是在结构内部洗牌的最有效方法
- C :结构内部的Armadillo矩阵
- 使用包含该结构内部结构的 using 定义
- 初始化指向另一个结构内部结构的指针
- 更改结构C 内部阵列的大小
- 如何与CUDA中的结构内部结构一起工作
- 如何在C++中访问数组结构内部的数组结构
- 另一个结构内部的结构数组的成员变量没有通过引用传递
- 结构内部的C++数组,如何处理它们
- 从构造函数中本地声明的device_vector使用device_vector::data()方法初始化结构内部的指针是
- 使用constexpr方法在结构内部进行模板参数化
- 访问结构内部的矢量size_type
- CPP 结构内部重载 () 运算符