On 9/5/12, Jan Hubicka <hubi...@ucw.cz> wrote: >> CONVERTERS AND TESTERS ########################################### >> >> add >> symtab_node_base &symtab_node_def::ref_symbol() >> { return symbol; } >> symtab_node_base &cgraph_node::ref_symbol() >> { return symbol; } >> symtab_node_base &varpool_node::ref_symbol() >> { return symbol; } >> >> change >> node->symbol.whatever >> to >> node->ref_symbol().whatever > > OK, the basic idea is that symtab_node is basetype of > cgraph_node and varpool_node.
Yes. > We may want to drop the historica cgraph/varpool names here, > since function_node/variable_node would sound better. Cgraph > still exists, but varpool is more or less historical relic. I have a general preference for making name changes separate from function changes when doing so makes svn diffs better reflect the actual changes. That may or may not be useful here, but I am happy to use those names for the final product. > I would expect inheritance to allow me to write node->whatever > and to have casting operators to convert things back and forth, > so we only need to add testers? The inheritance allows implicit derived to base conversion, which is type-safe. With inheritance, the converting functions are needed only for the conversion from base to derived, which generally requires dynamic information to be safe. > Probably is_function/is_variable & try_function/try_variable > sounds more readable to me. What do you think? Fine with me. > (I just arrived from China, so will take it more tought once > unjetlagged) -- Lawrence Crowl