/* RunTime Type Identification
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006
+ 2005, 2006, 2007
Free Software Foundation, Inc.
Mostly written by Jason Merrill (jason@cygnus.com).
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA. */
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
type = build_qualified_type (ptr_type_node,
cp_type_quals (TREE_TYPE (exp)));
- return build2 (PLUS_EXPR, type, exp,
- convert_to_integer (ptrdiff_type_node, offset));
+ return build2 (POINTER_PLUS_EXPR, type, exp,
+ convert_to_integer (sizetype, offset));
}
/* Get a bad_cast node for the program to throw...
fn = push_throw_library_fn (fn, build_function_type (ptr_type_node,
void_list_node));
- return build_cxx_call (fn, NULL_TREE);
+ return build_cxx_call (fn, 0, NULL);
}
/* Return an expression for "__cxa_bad_typeid()". The expression
fn = push_throw_library_fn (fn, t);
}
- return build_cxx_call (fn, NULL_TREE);
+ return build_cxx_call (fn, 0, NULL);
}
\f
/* Return an lvalue expression whose type is "const std::type_info"
/* Peel off cv qualifiers. */
type = TYPE_MAIN_VARIANT (type);
- if (!VOID_TYPE_P (type))
+ if (CLASS_TYPE_P (type))
type = complete_type_or_else (type, exp);
if (!type)
that is the operand of typeid are always ignored. */
type = TYPE_MAIN_VARIANT (type);
- if (!VOID_TYPE_P (type))
+ if (CLASS_TYPE_P (type))
type = complete_type_or_else (type, NULL_TREE);
if (!type)
else
{
tree retval;
- tree result, td2, td3, elems;
+ tree result, td2, td3;
+ tree elems[4];
tree static_type, target_type, boff;
/* If we got here, we can't convert statically. Therefore,
if (tc == REFERENCE_TYPE)
expr1 = build_unary_op (ADDR_EXPR, expr1, 0);
- elems = tree_cons
- (NULL_TREE, expr1, tree_cons
- (NULL_TREE, td3, tree_cons
- (NULL_TREE, td2, tree_cons
- (NULL_TREE, boff, NULL_TREE))));
+ elems[0] = expr1;
+ elems[1] = td3;
+ elems[2] = td2;
+ elems[3] = boff;
dcast_fn = dynamic_cast_node;
if (!dcast_fn)
pop_nested_namespace (ns);
dynamic_cast_node = dcast_fn;
}
- result = build_cxx_call (dcast_fn, elems);
+ result = build_cxx_call (dcast_fn, 4, elems);
if (tc == REFERENCE_TYPE)
{
/* We need to point into the middle of the vtable. */
vtable_ptr = build2
- (PLUS_EXPR, TREE_TYPE (vtable_ptr), vtable_ptr,
+ (POINTER_PLUS_EXPR, TREE_TYPE (vtable_ptr), vtable_ptr,
size_binop (MULT_EXPR,
size_int (2 * TARGET_VTABLE_DATA_ENTRY_DISTANCE),
TYPE_SIZE_UNIT (vtable_entry_type)));