[LLVMdev] Trying to access the user defined variable name
Devang Patel
devang.patel at gmail.com
Thu Jul 15 14:39:57 PDT 2010
On Thu, Jul 15, 2010 at 1:19 PM, Arvind Sudarsanam
<arvind.sudarsanam at aggiemail.usu.edu> wrote:
> Hi Devang,
>
> Thanks for your reply. You mentioned
> " First parameter is the compiler generated temp. and 3rd parameter
> provides info about the variable, including its name 'u'."
>
> I did manage to get this far. But, I am finding it difficult to access
> this info using LLVM APIs. The third parameter is of type "metadata".
> So I was able to access it by casting it to MDNode. After that, I am
> assuming that it gives me a handle to the metadata represented as
> "!10"
>
> !10 = metadata !{i32 524544, metadata !9, metadata !"u", metadata !2,
> i32 3, metadata !6} ; [DW_TAG_auto_variable ]
>
> From here, I am trying invain to access the variable name.
> Is there something wrong in my approach? I feel that I have not
> understood the method to access metadata in llvm.
>
Use DIVariable from DebugInfo.h to access fields of MDNode that is
holding variable's info.
-
Devang
More information about the llvm-dev
mailing list