[Lldb-commits] [PATCH] D27394: Fix expression evaluation inside lambda functions for gcc

Sean Callanan via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 5 10:49:15 PST 2016


spyffe added a subscriber: aprantl.
spyffe added a comment.

How does Clang-emitted debug information express the region in which a type is declared if it has been moved to the containing Decl?  I'm thinking specifically of this case:

  int foo() {
    return
      []() { struct A { int a; } a1; a1.a = 3; return a1.a; }() +
      []() { struct A { int b; } a2; a2.b = 4; return a2.b; }();
  }

As another point, it's not clear to me that the test is validating this.  There are no type declarations in the lambda in the test.

I'm not convinced this is all working fine at the moment, though:

  (lldb) br s -l 5
  (lldb) br s -l 6
  Breakpoint 2: 2 locations.
  (lldb) r
     3   	int foo() {
     4   	          return
  -> 5   	                      []() { struct A { int a; } a1; a1.a = 3; return a1.a; }() +
     6   	                          []() { struct A { int b; } a2; a2.b = 4; return a2.b; }();
     7   	}
     8
  (lldb) fr var
  (lldb) c
  (lldb) fr var
  (const (anonymous class) *) this = 0x00007fff5fbff678
  (A) a1 = (a = 1606416064)
  (lldb) c
  (lldb) fr var
  (lldb) c
  (lldb) fr var
  (const (anonymous class) *) this = 0x00007fff5fbff670
  (A) a2 = (a = 3)

I suggest we bring @aprantl in to this discussion.


https://reviews.llvm.org/D27394





More information about the lldb-commits mailing list