Skip to content

[clangd] Show Value on hover for objects representable at constexpr #129448

Open
@torshepherd

Description

@torshepherd

Currently, hovers on basic values like const char* display their constexpr value:

Image

However, hovers on structs and other objects don't show a value:

Image

They could feasibly use one of three strategies for displaying a value:

  1. Do the same thing that P2741R3 does; if the type has .data() and .size() methods, treat it as a way to display the values and use them to render characters in the hover.
  2. if the type has a constexpr ostream operator, constexpr formatter specialization, etc. use that.
  3. __builtin_dump_struct or similar method of displaying the fields

I think #1 is the cleanest, and as more things become possible at constexpr this could be useful for debugging constexpr code more easily.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clangdconstexprAnything related to constant evaluation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions