How to preserve struct member identifiers when compiling to LLVM IR with Clang?
Posted
by
smokris
on Stack Overflow
See other posts from Stack Overflow
or by smokris
Published on 2011-02-07T04:09:42Z
Indexed on
2011/02/07
7:25 UTC
Read the original article
Hit count: 284
Say I have the following C structure definition:
struct stringStructure
{
char *stringVariable;
};
For the above, Clang produces the following LLVM IR:
%struct.stringStructure = type { i8* }
...which includes everything in my definition except the variable identifier stringVariable
.
I'd like to find some way to export the identifier into the generated LLVM IR, so that I can refer to it by name from my application (which uses the LLVM C++ API).
I've tried adding the annotate
attribute, as follows:
char *stringVariable __attribute__((annotate("stringVariable")));
...but the annotation doesn't seem to make it through (the structure is still just defined as type { i8* }
).
Any ideas?
© Stack Overflow or respective owner