/* Abstraction of GNU v3 abi.
Contributed by Jim Blandy <jimb@redhat.com>
- Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2015 Free Software Foundation, Inc.
This file is part of GDB.
#include "objfiles.h"
#include "valprint.h"
#include "c-lang.h"
-#include "exceptions.h"
#include "typeprint.h"
-#include "gdb_assert.h"
-#include <string.h>
-
static struct cp_abi_ops gnu_v3_abi_ops;
/* A gdbarch key for std::type_info, in the event that it can't be
char *atsign;
/* We only have RTTI for class objects. */
- if (TYPE_CODE (values_type) != TYPE_CODE_CLASS)
+ if (TYPE_CODE (values_type) != TYPE_CODE_STRUCT)
return NULL;
/* Java doesn't have RTTI following the C++ ABI. */
struct gdbarch *gdbarch;
/* Some simple sanity checks. */
- if (TYPE_CODE (values_type) != TYPE_CODE_CLASS)
+ if (TYPE_CODE (values_type) != TYPE_CODE_STRUCT)
error (_("Only classes can have virtual functions."));
/* Determine architecture. */
/* We check for lval_memory because in the "typeid (type-id)" case,
the type is passed via a not_lval value object. */
- if (TYPE_CODE (type) == TYPE_CODE_CLASS
+ if (TYPE_CODE (type) == TYPE_CODE_STRUCT
&& value_lval_const (value) == lval_memory
&& gnuv3_dynamic_class (type))
{
if (minsym.minsym == NULL)
error (_("could not find typeinfo symbol for '%s'"), typename);
- result = value_at_lazy (typeinfo_type,
- MSYMBOL_VALUE_ADDRESS (minsym.minsym));
+ result = value_at_lazy (typeinfo_type, BMSYMBOL_VALUE_ADDRESS (minsym));
}
do_cleanups (cleanup);
if (fn_sym.minsym == NULL)
return 0;
- method_stop_pc = MSYMBOL_VALUE_ADDRESS (fn_sym.minsym);
+ method_stop_pc = BMSYMBOL_VALUE_ADDRESS (fn_sym);
/* Some targets have minimal symbols pointing to function descriptors
(powerpc 64 for example). Make sure to retrieve the address
/* We're only interested in things that can have methods. */
if (TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_CLASS
&& TYPE_CODE (type) != TYPE_CODE_UNION)
return 0;
+ /* A dynamic class has a non-trivial copy constructor.
+ See c++98 section 12.8 Copying class objects [class.copy]. */
+ if (gnuv3_dynamic_class (type))
+ return 1;
+
for (fieldnum = 0; fieldnum < TYPE_NFN_FIELDS (type); fieldnum++)
for (fieldelem = 0; fieldelem < TYPE_FN_FIELDLIST_LENGTH (type, fieldnum);
fieldelem++)
/* If this method takes two arguments, and the second argument is
a reference to this class, then it is a copy constructor. */
- if (TYPE_NFIELDS (fieldtype) == 2
- && TYPE_CODE (TYPE_FIELD_TYPE (fieldtype, 1)) == TYPE_CODE_REF
- && check_typedef (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (fieldtype,
- 1))) == type)
- return 1;
+ if (TYPE_NFIELDS (fieldtype) == 2)
+ {
+ struct type *arg_type = TYPE_FIELD_TYPE (fieldtype, 1);
+
+ if (TYPE_CODE (arg_type) == TYPE_CODE_REF)
+ {
+ struct type *arg_target_type;
+
+ arg_target_type = check_typedef (TYPE_TARGET_TYPE (arg_type));
+ if (class_types_same_p (arg_target_type, type))
+ return 1;
+ }
+ }
}
/* Even if all the constructors and destructors were artificial, one