From a3bfa8b80c84f097b684b5ba7851ceb81642ccd3 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 29 Oct 2013 18:25:17 +0000 Subject: Convert symtab, cgraph and varpool nodes into a real class hierarchy This is the handwritten part of the patch; automated part to follow. * cgraph.h (symtab_node_base): Convert to a class; add GTY((desc ("%h.type"), tag ("SYMTAB_SYMBOL"))), and take chain_next/prev from symtab_node_def. (cgraph_node): Inherit from symtab_node; add GTY option tag ("SYMTAB_FUNCTION"). (varpool_node): Inherit from symtab_node; add GTY option tag ("SYMTAB_VARIABLE"). (symtab_node_def): Remove. (is_a_helper ::test (symtab_node_def *)): Convert to... (is_a_helper ::test (symtab_node_base *)): ...this. (is_a_helper ::test (symtab_node_def *)): Convert to... (is_a_helper ::test (symtab_node_base *)): ...this. * ipa-ref.h (symtab_node_def): Drop. (symtab_node): Change underlying type from symtab_node_def to symtab_node_base. (const_symtab_node): Likwise. * is-a.h: Update examples in comment. * symtab.c (symtab_hash): Change symtab_node_def to symtab_node_base. (assembler_name_hash): Likewise. From-SVN: r204170 --- gcc/is-a.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/is-a.h') diff --git a/gcc/is-a.h b/gcc/is-a.h index b5ee854..ccf12be 100644 --- a/gcc/is-a.h +++ b/gcc/is-a.h @@ -31,7 +31,7 @@ bool is_a (pointer) Tests whether the pointer actually points to a more derived TYPE. - Suppose you have a symtab_node_def *ptr, AKA symtab_node ptr. You can test + Suppose you have a symtab_node_base *ptr, AKA symtab_node ptr. You can test whether it points to a 'derived' cgraph_node as follows. if (is_a (ptr)) @@ -110,7 +110,7 @@ example, template <> template <> inline bool - is_a_helper ::test (symtab_node_def *p) + is_a_helper ::test (symtab_node_base *p) { return p->symbol.type == SYMTAB_FUNCTION; } @@ -122,7 +122,7 @@ when needed may result in a crash. For example, template <> template <> inline bool - is_a_helper ::cast (symtab_node_def *p) + is_a_helper ::cast (symtab_node_base *p) { return &p->x_function; } -- cgit v1.1