This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v4 00/11] [PR gdb/14441] Support C++0x rvalue references in gdb


Hi all,

this is my fourth take on fixing gdb/14441 which deals with C++0x rvalue
references.

The approach is rather straightforward and the work for the most part consisted
of mimicking the behavior for regular references. In gdbtypes.c, several helper
functions were introduced and some parameterized by the reference kind to
simplify the access to reference type objects API.

The only interesting part is the addition of overloading resolution rules
with regard to rvalue references. All of the cases introduced in 13.3.3.1.4 and
13.3.3.2 were accounted for at the beginning of rank_one_type().

With this patch it is now also possible to fix the evaluation of decltype,
which should return a plain type object, an lvalue reference or an rvalue
reference depending on a type category of the type of its operand. However,
this would require introduction of the type category notion to gdb, which I
think only needs adding a new constant to lval_type and propagating the type
category through different parts of an expression in gdb/valops.c. I'm willing
to do this if this patchset turns out to be OK.

Changes from v1 consist of dropping the libiberty part of 05/11 and the
consequent testsuite changes. I have learned that introducing rvalue reference
support to the demangler in cplus-dem.c is completely unnecessary, since
virtually all contemporary compilers generate symbol names handled in
cp-demangle.c. Therefore I have removed some of the testcases in
gdb.cp/demangle.exp and switched the others to use the gnu-v3 demangling style.

Changes from v2 are numerous coding style fixes, improvements and
simplifications of the changelog, reorganization and reordering of the
patchset, removal of redundant code in gdb/python/*, addition of a couple of
python tests, and a few bugfixes.

Changes from v3 are a few more coding style / English grammar fixes and code
simplifications left over from v2.

Artemiy Volkov (11):
  gdb: gdbtypes: add definitions for rvalue reference type
  gdb: gdbtypes: change {lookup,make}_reference_type() API
  gdb: valops: add ability to return rvalue reference values from
    value_ref()
  gdb: parse: support rvalue reference type
  gdb: demangle: implement demangling for rvalue reference typenames
  gdb: print: implement correct printing of rvalue reference types and
    values
  gdb: dwarf2read: support DW_TAG_rvalue_reference type
  gdb: python: support rvalue references in the gdb module
  gdb: convert lvalue reference type check to general reference type
    check
  gdb: gdbtypes: add rvalue references to overloading resolution
  gdb: testsuite: add rvalue reference tests

 gdb/aarch64-tdep.c                       |   5 +-
 gdb/ada-lang.c                           |   2 +-
 gdb/amd64-tdep.c                         |   2 +-
 gdb/amd64-windows-tdep.c                 |   1 +
 gdb/arm-tdep.c                           |   5 +-
 gdb/ax-gdb.c                             |   2 +
 gdb/c-exp.y                              |   6 +-
 gdb/c-typeprint.c                        |  10 +--
 gdb/c-valprint.c                         |  14 +++--
 gdb/c-varobj.c                           |  10 +--
 gdb/compile/compile-c-symbols.c          |   2 +-
 gdb/completer.c                          |   3 +-
 gdb/cp-name-parser.y                     |   4 ++
 gdb/cp-support.c                         |   3 +-
 gdb/darwin-nat-info.c                    |   2 +-
 gdb/dwarf2loc.c                          |   4 +-
 gdb/dwarf2read.c                         |  15 +++--
 gdb/eval.c                               |  16 ++---
 gdb/f-exp.y                              |   2 +-
 gdb/findvar.c                            |   6 +-
 gdb/gdbtypes.c                           | 105 ++++++++++++++++++++++++++-----
 gdb/gdbtypes.h                           |  20 +++++-
 gdb/guile/scm-type.c                     |   2 +-
 gdb/guile/scm-value.c                    |   2 +-
 gdb/hppa-tdep.c                          |   1 +
 gdb/infcall.c                            |   5 +-
 gdb/language.c                           |   3 +-
 gdb/m32c-tdep.c                          |   8 +--
 gdb/m88k-tdep.c                          |   1 +
 gdb/mn10300-tdep.c                       |   1 +
 gdb/msp430-tdep.c                        |   2 +-
 gdb/parse.c                              |  39 +++++++-----
 gdb/parser-defs.h                        |   1 +
 gdb/ppc-sysv-tdep.c                      |   7 +--
 gdb/printcmd.c                           |   2 +-
 gdb/python/lib/gdb/command/explore.py    |   2 +-
 gdb/python/lib/gdb/types.py              |   4 +-
 gdb/python/py-type.c                     |  14 +++--
 gdb/python/py-value.c                    |  16 +++--
 gdb/python/py-xmethods.c                 |  12 ++--
 gdb/s390-linux-tdep.c                    |   2 +-
 gdb/sparc-tdep.c                         |   1 +
 gdb/sparc64-tdep.c                       |   1 +
 gdb/spu-tdep.c                           |   1 +
 gdb/stabsread.c                          |   3 +-
 gdb/symtab.c                             |   3 +-
 gdb/testsuite/gdb.cp/casts.cc            |   8 ++-
 gdb/testsuite/gdb.cp/casts.exp           |  35 +++++++++--
 gdb/testsuite/gdb.cp/cpsizeof.cc         |   4 ++
 gdb/testsuite/gdb.cp/cpsizeof.exp        |   3 +-
 gdb/testsuite/gdb.cp/demangle.exp        |  36 +++++++++++
 gdb/testsuite/gdb.cp/overload.cc         |  18 +++++-
 gdb/testsuite/gdb.cp/overload.exp        |  16 ++++-
 gdb/testsuite/gdb.cp/ref-params.cc       |  27 ++++++++
 gdb/testsuite/gdb.cp/ref-params.exp      |  21 ++++++-
 gdb/testsuite/gdb.cp/ref-types.cc        |  24 +++++++
 gdb/testsuite/gdb.cp/ref-types.exp       |  92 ++++++++++++++++++++++++++-
 gdb/testsuite/gdb.python/py-value-cc.cc  |   4 ++
 gdb/testsuite/gdb.python/py-value-cc.exp |  10 ++-
 gdb/typeprint.c                          |   4 +-
 gdb/valarith.c                           |   6 +-
 gdb/valops.c                             |  72 +++++++++++----------
 gdb/valprint.c                           |   5 +-
 gdb/value.c                              |  12 ++--
 gdb/value.h                              |   2 +-
 gdb/varobj.c                             |   2 +-
 66 files changed, 593 insertions(+), 180 deletions(-)

-- 
2.7.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]