How to preserve struct member identifiers when compiling to LLVM IR with Clang?
- by smokris
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?