[LLVMdev] collect end line number for scope

Devang Patel
Tue, 04 Oct 2011 16:38:53 -0000

Pankaj,

On Oct 3, 2011, at 4:36 AM, Pankaj Gode wrote:

> Hi All,
>
> int global;
> int func( int t)
> {
>   //scope 1
>   {
>      ....
>   } <-----
>   return x;
> }
>
> For the above code, i want to collect endline (indicated by <---) for
the scope. Can we get this information from the Dwarf Information in llvm 2.9 ?
>

If there is no code generated for a source line with just "}", so you
are not going to get that line number in debug info (because there is not any
llvm instruction). You can access the line number for the last
statement/expression in the scope. See
http://llvm.org/docs/SourceLevelDebugging.html#ccxx_compile_units for a code
snippet on how to get line number from an llvm instruction.

What exactly are you trying to do? Depending on your needs, you may be able to
access clang AST nodes to get exact line and column number information for
"}" irrespective of debug info.

-
Devang
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20111004/1ae420cc/attachment.html>