[Bug 36403] New: LLDB Data Formatter for References

Bug ID 36403
Summary LLDB Data Formatter for References
Product lldb
Version unspecified
Hardware PC
OS Linux
Status NEW
Severity enhancement
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter fantaosha@gmail.com
CC llvm-bugs@lists.llvm.org

[https://stackoverflow.com/questions/48738074/lldb-data-formatter-for-references](https://stackoverflow.com/questions/48738074/lldb-data-formatter-for-references)

I'm currently developing data formatters for my own types. However, I encounter
some problems to print references.

#include <iostream>

class Circle
{
  protected:
    double R;
    double a;
    double b;

  public:
    Circle():R(1), a(0), b(0)
    {
    }
};

int main()
{
  Circle A;
  Circle & B = A;

  return 0;
}

And I use type summary add to customize my own data formatters

(lldb) type summary add -s "The circle is (R = ${var.R}, a = ${var.a}, b =
${var.b})" Circle
Now it goes very well for non-references, for example

(lldb) frame variable A
(Circle) A = The circle is (R = 1, a = 0, b = 0)
However, for references,

(lldb) frame variable B
(Circle &const) B = 0x00007fffffffd200 The circle is (R = 1, a = 0, b = 0): {
  R = 1
  a = 0
  b = 0
}
for which the contents after ":" is not wanted.

It seems that this is a bug.