[cfe-dev] Line numbers in debug info for range based for

Justin Bogner mail at justinbogner.com
Fri May 2 14:16:59 PDT 2014


When we emit a range-based for, we get debug info for the __range,
__begin, and __end variables of the equivalent construct:

  {
    auto && __range = range-init;
    for (auto __begin = begin-expr, __end = end-expr;
         __begin != __end; ++__begin) {
      for-range-declaration = *__begin;
      // ...
    }
  }

Currently, these variables don't have any line information associated
with them. It looks to me like they did before r188651:

  commit fc946271e008544b518321fdecc77ca076663c12
  Author: David Blaikie <dblaikie at gmail.com>
  Date:   Mon Aug 19 03:37:48 2013 +0000
  
      DebugInfo: Do not include line/file info for artificial parameters &
      parameters of artificial functions
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188651
      91177308-0d34-0410-b5e6-96231b3b80d8

That commit message is specifically about functions, so it's not clear
if the change to artificial variables was intentional.

Should these variables have line information? On the one hand, they're
artificial, but on the other, they do have a pretty obvious source
location they correspond to.

Thoughts?



More information about the cfe-dev mailing list