<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Member expressions have wrong debug column information"
   href="https://llvm.org/bugs/show_bug.cgi?id=27567">27567</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Member expressions have wrong debug column information
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>LLVM Codegen
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hfinkel@anl.gov
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Consider the following:
$ cat -n /tmp/i.cpp 
     1    void ext();
     2    
     3    struct Bar {
     4      void bar() { ext(); }
     5    };
     6    
     7    struct Foo {
     8      Bar *b;
     9    
    10      Bar *foo() { return b; }
    11    };
    12    
    13    void test(Foo *f) {
    14      f->foo()->bar();
    15    }
    16    

Running:

$ clang -g /tmp/i.cpp -S -emit-llvm -o - 
we see...

define void @_Z4testP3Foo(%struct.Foo* %f) #0 !dbg !6 {
  ...
  %call = call %struct.Bar* @_ZN3Foo3fooEv(%struct.Foo* %0), !dbg !27
  call void @_ZN3Bar3barEv(%struct.Bar* %call), !dbg !28
  ...
!27 = !DILocation(line: 14, column: 3, scope: !6)
!28 = !DILocation(line: 14, column: 3, scope: !29)

so the two call instructions both point to the 'f' in 'f->foo()->bar()', not to
the calls to 'foo()' and 'bar()' themselves.

Running:

$ clang -g /tmp/i.cpp -S -emit-llvm -o - -Xclang -ast-dump
we see...

`-FunctionDecl 0x5ce7cd0 <line:13:1, line:15:1> line:13:6 test 'void (struct
Foo *)'
  |-ParmVarDecl 0x5ce7c08 <col:11, col:16> col:16 used f 'struct Foo *'
  `-CompoundStmt 0x5ce7e80 <col:19, line:15:1>
    `-CXXMemberCallExpr 0x5ce7e58 <line:14:3, col:17> 'void'
      `-MemberExpr 0x5ce7e20 <col:3, col:13> '<bound member function type>'
->bar 0x5ce7640
        `-CXXMemberCallExpr 0x5ce7df8 <col:3, col:10> 'struct Bar *'
          `-MemberExpr 0x5ce7dc0 <col:3, col:6> '<bound member function type>'
->foo 0x5ce7a80
            `-ImplicitCastExpr 0x5ce7da8 <col:3> 'struct Foo *'
<LValueToRValue>
              `-DeclRefExpr 0x5ce7d80 <col:3> 'struct Foo *' lvalue ParmVar
0x5ce7c08 'f' 'struct Foo *'

So the correct column numbers, 6 and 13, are the second location in the
MemberExpr nodes, not the first. Those second locations should end up in the
debug info.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>