[llvm-bugs] [Bug 27567] New: Member expressions have wrong debug column information

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 28 18:54:01 PDT 2016


            Bug ID: 27567
           Summary: Member expressions have wrong debug column information
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hfinkel at anl.gov
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Consider the following:
$ cat -n /tmp/i.cpp 
     1    void ext();
     3    struct Bar {
     4      void bar() { ext(); }
     5    };
     7    struct Foo {
     8      Bar *b;
    10      Bar *foo() { return b; }
    11    };
    13    void test(Foo *f) {
    14      f->foo()->bar();
    15    }


$ 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.


$ 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 *'
              `-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.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160429/091797b7/attachment.html>

More information about the llvm-bugs mailing list