假设我有以下 C 结构定义:
struct stringStructure
{
char *stringVariable;
};
对于上述情况,Clang 生成以下 LLVM IR:
%struct.stringStructure = type { i8* }
...包括我定义中的所有内容,除了变量 identifier stringVariable
。
我想找到某种方法将标识符导出到生成的 LLVM IR 中,以便我可以从我的应用程序(使用 LLVM C++ API)中按名称引用它。
我试过添加annotate
属性,如下:
char *stringVariable __attribute__((annotate("stringVariable")));
...但是注释似乎没有通过(结构仍然只是定义为type { i8* }
)。
有任何想法吗?