<div dir="ltr">Hi Peter,<br><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>First, in the case of multi-line statements, clang will assign the debug data for each expression to be the first line of the statement but continue incrementing the column number past the number of columns on the line.  The following code gives an example:</div>


<div>[1] int foo(){</div><div>[2]   int x, y, z;</div><div>[3]   if(x < y ||</div><div>[4]      y < z){</div><div>[5]     x++;</div><div>[6]   }</div><div>[7] }</div><div>

In this example, when my LLVM pass gets the bitcode both the (x<y) and (y<z) expressions are assigned DebugLocs which have line number 3 (but with increasing column numbers).</div><div><br></div></div></blockquote>
<div><br></div><div style>This...</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div></div><div>Second, in the case of a do-while statement where the closing } and the while condition are not on the same line, all expressions in the while condition are assigned the line number of the }.  The following code gives an example:</div>


<div>[1] int foo(){</div><div>[2]   int x;</div><div>[3]   do</div><div>[4]   {</div><div>[5]     x++;</div><div>[6]   }</div><div>[7]   while(x < 10);</div><div>[8] }</div>

<div>In this case, the DebugLoc for the (x<10) expression lists line number 6.</div><div><br></div></div></blockquote><div><br></div><div style>and this are both really weird. The line (and column with -gcolumn-info) are generally handled by the source ranges on the individual statements, but looking in the IR those are the line's we're giving. If you file a bug we'll probably get to it eventually, but source locations are set in the debug info via setLocation from lib/CodeGen/CGDebugInfo.cpp. You'll probably want to look for the particular AST nodes here and see where they're setting locations. I think they're likely simple so you might want to check on the SourceLocation for the individual nodes and see what the begin and end are.</div>
<div style><br></div><div style>-eric</div></div><br></div></div>