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]

Re: [RFC] Extend existing support for evaluating expressions using overloaded operators


Siva> I will stage the clean up and extension in multiple patches. Also,
Siva> that way I will get to discuss in smaller pieces as to why the code is
Siva> the way it is.

I have submitted
http://sourceware.org/ml/gdb-patches/2012-06/msg00245.html as the
first cleanup patch. Attached now is a patch which extends the
overloaded operator support. It contains a minor refactoring so that
the overloaded operator support can be extended to cases where the
first operand of a binary operation is a non-struct/non-union. Note
that this patch does not yet extend the support into Python API.

2012-06-18  Siva Chandra Reddy  <sivachandra@google.com>

        Extend existing support for evaluating expressions using
        overloaded operators.
        * gdbtypes.c (is_compound_type): New function to test if a type
        is a struct or union.
        (type_can_have_methods): New function to check if a type can
        have methods defined on it.
        * gdbtypes.h (is_compound_type, type_can_have_methods): Declare.
        * valarith.c (value_user_defined_cpp_op): Make different calls
        to 'find_overload_match' based on the type of the first
        argument.
        (value_x_binop): Extend to handle binary operations which have
        either or both operands of a compound value. Pass operands as is
        to value_user_defined_op.
        (value_x_unop): Pass operand as is to value_user_defined_op.
        (binop_types_user_defined_p): Use is_compound_type to include
        unions.

        testsuite/
        * gdb.cp/operator.cc: Add test cases to test overloaded
        binary operator evaluation.
        * gdb.cp/operator.exp: Add tests to test overloaded binary
        operator evaluation.

Thanks,
Siva Chandra

Attachment: oprovld_patch_v3.txt
Description: Text document


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