[llvm-dev] Structure field names

Ryan Taylor via llvm-dev llvm-dev at lists.llvm.org
Wed Sep 7 13:23:19 PDT 2016

if (Value->hasName())


You can iterate the elements of the struct doing this:

If (Value->getType()->isStructTy())
   for(StructType::element_iterator ii = Value->element_begin(), ei =
Value->element_end(); ii != ei; ++ii) {

You could do this recursively for structs with structs of structs etc and
so forth. Some permutation of this should work.



On Tue, Sep 6, 2016 at 12:44 AM, Jiten Thakkar via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hi All,
> I am working on a project as part of my graduate study which uses LLVM.
> I am relatively new to LLVM.
> My goal is to get names of the parameters to functions. If the parameter
> is a structure, then I also need to name of the fields of the structure.
> I assume that metadata info should provide this but so far I am unable to
> find any documentation regarding which would describe how to do it.
> Is there a way to do this? Is this even possible?
> Please let me know if any of this is confusing and I will try to describe
> it in detail.
> Thanks,
> Jiten
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160907/f9fa52ee/attachment-0001.html>

More information about the llvm-dev mailing list