On Mon, Oct 6, 2014 at 5:55 PM, Jason Merrill <ja...@redhat.com> wrote: > On 10/06/2014 08:50 PM, Siva Chandra wrote: >> But, the question is whether it is required to determine the parameter >> passing ABI. If there is no special marker to indicate that the user >> declared 'tor is explicitly defaulted, then GDB could (in the absence >> of other properties which make the 'tor non-trivial) incorrectly >> conclude that the the 'tor is user defined, and hence not-trivial. > > I've been thinking that we should just mark the 'tor as trivial or not > directly rather than hint at it. Does GDB have enough information to > determine triviality if we just add defaulted info?
Barring some incompleteness, for which patches are very close to getting committed, I believe GDB has the rest of the information. After those patches are committed, the algorithm used by GDB to determine whether a value is returned in a hidden param or not is as follows: 1. If the value is of a dynamic class (as in, has virtual bases or virtual functions), return in hidden param. 2. Else, go over all methods that are found in the DWARF: ----2a. If a method is marked artificial, ignore it. ----2b. If the method is a copy-constructor or a destructor, conclude that a pointer to the value is to be returned in the hidden first param. -------- This is because, presence of a copy-ctor or dtor which are nor artificial indicates that they were user declared and not implicit. 3. If a decision was not made in 2, do 1 and 2 for base class subobjects and non-static members. 4. If a decision was not made in 3, then conclude that it should not be passed in a hidden param. If an explicitly defaulted copy-ctor or dtor is not marked as such, step 2 is broken.