C++: Improve printing of REFLECT_EXPR in diagnostics.
Enhances REFLECT_EXPR printing in diagnostics to use C++ syntax where possible, improving readability.
This commit improves the printing of REFLECT_EXPR in C++ diagnostics to use more C++-like syntax, making the output more understandable. It attempts to use valid C++ syntax for REFLECT_BASE, REFLECT_PARM, REFLECT_DATA_MEMBER_SPEC, REFLECT_VALUE, and REFLECT_OBJECT. For annotations, it prints them as ^^[[=1]] because the IL doesn’t store the context of the attributes.
In Details
The patch modifies dump_expr in error.cc to improve the printing of various reflections. It uses C++ valid syntax for REFLECT_BASE, REFLECT_PARM, REFLECT_DATA_MEMBER_SPEC, REFLECT_VALUE, and REFLECT_OBJECT. For annotations (whose decl/type isn't stored in IL), it prints them as ^^[[=1]]. The changes also touch cp-tree.h and reflect.cc to adjust maybe_update_function_parm.
For Context
When a compiler encounters an error, it tries to provide helpful information to the user about what went wrong. This commit improves how the C++ compiler displays information about reflection expressions, which are used to examine the structure of code at compile time. The changes make the error messages easier to read and understand by using more familiar C++ syntax where possible.