Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Class_symbol Class Reference

! Symbol for a class or union type. More...

#include <class.h>

Inheritance diagram for Class_symbol:

Inheritance graph
[legend]
Collaboration diagram for Class_symbol:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::vector< Class_symbol * > bases_t
typedef std::vector< Variable_symbol * > members_t
typedef std::vector< Function_symbol * > memfuns_t

Public Methods

 Class_symbol (Kind k, Abstract_scope *in_scope, std::string real_name)
 ~Class_symbol ()
Symbol::Kind get_kind () const
bool is_pod () const
bool is_aggregate () const
const std::string & get_real_name () const
bool is_base_class_of (Class_symbol *other) const
bool is_unique_base_class_of (Class_symbol *other) const
void enumerate_base_classes (bool with_virtuals, bases_t *output)
void add_base_class (Class_symbol *sym, bool is_virt)
 Add base class. More...

void dump (std::ostream &os)
 Dump symbol on /out/. More...

Symbol_pair lookup_helper (std::string name) const
Class_scopeget_scope ()
 If this symbol names a scope, return that scope. More...

Class_symbol::members_t::const_iterator mem_begin () const
Class_symbol::members_t::const_iterator mem_end () const
Class_symbol::bases_t::const_iterator vbc_begin () const
Class_symbol::bases_t::const_iterator vbc_end () const
Class_symbol::bases_t::const_iterator base_begin () const
Class_symbol::bases_t::const_iterator base_end () const
void start_definition (std::string basename)
 Start class definition. More...

void finish_definition ()
 Finish class definition. More...


Private Types

enum  Assignment_operator { no_assignment_operator, const_assignment_operator, nonconst_assignment_operator }

Private Methods

void maybe_add_vbc (Class_symbol *sym)
 Add virtual base class, if it is not already there. More...

Function_signatureget_copy_ctor (Function_symbol *fsym, bool must_be_ref) const
 Given a function signature, return the copy constructor or assignment operator (i.e. More...

bool implicit_copy_ctor_is_const () const
Class_symbol::Assignment_operator implicit_assignment_operator_style () const

Private Attributes

Kind k
Abstract_scopein_scope
std::string real_name
bases_t base_classes
bases_t virtual_base_classes
members_t members
memfuns_t member_functions
bool pod
bool aggregate

Friends

class Class_lookup_helper
class Class_scope

Detailed Description

! Symbol for a class or union type.

Definition at line 54 of file class.h.


Member Typedef Documentation

typedef std::vector<Class_symbol*> Class_symbol::bases_t
 

Definition at line 56 of file class.h.

Referenced by Class_scope::add_function_decl(), and enumerate_conversion_ops().

typedef std::vector<Variable_symbol*> Class_symbol::members_t
 

Definition at line 57 of file class.h.

typedef std::vector<Function_symbol*> Class_symbol::memfuns_t
 

Definition at line 58 of file class.h.


Member Enumeration Documentation

enum Class_symbol::Assignment_operator [private]
 

Enumeration values:
no_assignment_operator 
const_assignment_operator 
nonconst_assignment_operator 

Definition at line 74 of file class.h.

Referenced by finish_definition(), and implicit_assignment_operator_style().


Constructor & Destructor Documentation

Class_symbol::Class_symbol Kind    k,
Abstract_scope   in_scope,
std::string    real_name
 

Definition at line 39 of file class.cc.

Class_symbol::~Class_symbol  
 

Definition at line 46 of file class.cc.


Member Function Documentation

void Class_symbol::add_base_class Class_symbol *    sym,
bool    is_virt
 

Add base class.

This will also check conditions (class must be defined, class must not already be a base class, ...). FIXME: This does not reject ': virtual A, virtual A'.

Definition at line 123 of file class.cc.

References aggregate, base_classes, compile_error(), get_kind(), Symbol::get_name(), Symbol::is_defined(), Symbol::k_ClassOrStruct, maybe_add_vbc(), pod, and virtual_base_classes.

Referenced by process_base_classes().

Class_symbol::bases_t::const_iterator Class_symbol::base_begin   const [inline]
 

Definition at line 281 of file class.h.

References base_classes.

Referenced by process_initializers().

Class_symbol::bases_t::const_iterator Class_symbol::base_end   const [inline]
 

Definition at line 288 of file class.h.

References base_classes.

Referenced by process_initializers().

void Class_symbol::dump std::ostream &    os [virtual]
 

Dump symbol on /out/.

Derived classes can override this to add own information.

Reimplemented from Symbol.

Definition at line 147 of file class.cc.

References base_classes, Symbol::dump(), and virtual_base_classes.

void Class_symbol::enumerate_base_classes bool    with_virtuals,
bases_t   output
 

Definition at line 86 of file class.cc.

References base_classes, and virtual_base_classes.

Referenced by Class_scope::add_function_decl(), and enumerate_conversion_ops().

void Class_symbol::finish_definition  
 

Finish class definition.

Definition at line 188 of file class.cc.

References Type::add_qualifier(), Function_symbol::add_signature(), Class_scope::add_symbol(), aggregate, Assignment_operator, Symbol_name::ASSIGNMENT_OPERATOR_NAME, const_assignment_operator, Symbol_name::CONSTRUCTOR_NAME, f_Inline, get_copy_ctor(), get_scope(), Type_symbol::get_type(), implicit_assignment_operator_style(), implicit_copy_ctor_is_const(), Symbol_name::k_Constructor, Symbol_name::k_Operator, lookup_helper(), Type::make_reference_type(), make_unary_function_type(), member_functions, Function_symbol::must_be_new, no_assignment_operator, pod, Type::q_Const, s_Member, Function_signature::set_generated(), and Symbol_pair::untag.

Referenced by parse_class().

Function_signature * Class_symbol::get_copy_ctor Function_symbol   fsym,
bool    must_be_ref
const [private]
 

Given a function signature, return the copy constructor or assignment operator (i.e.

the signature which takes a "cv-T&" as parameter).

Definition at line 250 of file class.cc.

References Type::get_function_arg(), Type::get_kind(), Type::get_num_function_args(), Function_signature::get_proto_type(), Type_symbol::get_type(), Type::is_same_unqualified_type(), Type::k_Reference, Type::sans_reference(), Function_symbol::sig_begin(), Function_symbol::sig_end(), and Function_symbol::Sig_it.

Referenced by finish_definition(), implicit_assignment_operator_style(), and implicit_copy_ctor_is_const().

Symbol::Kind Class_symbol::get_kind   const [virtual]
 

Implements Symbol.

Definition at line 52 of file class.cc.

References k.

Referenced by add_base_class(), and Init_handler::process_class().

const std::string & Class_symbol::get_real_name   const [inline]
 

Definition at line 237 of file class.h.

References real_name.

Referenced by Class_scope::is_constructor().

Class_scope * Class_symbol::get_scope   [virtual]
 

If this symbol names a scope, return that scope.

Otherwise, return 0

Reimplemented from Symbol.

Definition at line 165 of file class.cc.

References Class_scope.

Referenced by Expr_annotator::do_funcall(), finish_definition(), gen_constructors(), Symbol_name::lookup_symbol_in_scope(), parse_class(), Expr_annotator::process_member_access(), Expr_annotator::visit_array(), Expr_annotator::visit_arrowmember(), Expr_annotator::visit_assign(), Expr_annotator::visit_comma(), Expr_annotator::visit_postfix(), and Expr_annotator::visit_unary().

Class_symbol::Assignment_operator Class_symbol::implicit_assignment_operator_style   const [private]
 

Definition at line 296 of file class.cc.

References Assignment_operator, Symbol_name::ASSIGNMENT_OPERATOR_NAME, base_classes, const_assignment_operator, Type::get_basis_type(), get_copy_ctor(), Type::get_function_arg(), Type::get_kind(), Function_signature::get_proto_type(), Type::get_type_symbol(), Type::is_class_type(), Type::is_qualified(), Type::k_Reference, lookup_helper(), mem_begin(), mem_end(), no_assignment_operator, nonconst_assignment_operator, Type::q_Const, Symbol_pair::untag, and virtual_base_classes.

Referenced by finish_definition().

bool Class_symbol::implicit_copy_ctor_is_const   const [private]
 

Definition at line 267 of file class.cc.

References base_classes, Symbol_name::CONSTRUCTOR_NAME, Type::get_basis_type(), get_copy_ctor(), Type::get_function_arg(), Function_signature::get_proto_type(), Type::get_type_symbol(), Type::is_class_type(), Type::is_qualified(), lookup_helper(), mem_begin(), mem_end(), Type::q_Const, Symbol_pair::untag, and virtual_base_classes.

Referenced by finish_definition().

bool Class_symbol::is_aggregate   const [inline]
 

Definition at line 230 of file class.h.

References aggregate.

Referenced by Init_handler::get_default_initializer_for_type(), Type::is_aggregate(), and Init_handler::process_brace().

bool Class_symbol::is_base_class_of Class_symbol *    other const
 

Definition at line 60 of file class.cc.

References base_classes, and virtual_base_classes.

Referenced by Implicit_conversion::convert_reference(), get_composite_mptr_type(), is_unique_base_class_of(), and Implicit_conversion::scs_is_better_than().

bool Class_symbol::is_pod   const [inline]
 

Definition at line 223 of file class.h.

References pod.

Referenced by Type::is_pod().

bool Class_symbol::is_unique_base_class_of Class_symbol *    other const
 

Definition at line 77 of file class.cc.

References is_base_class_of().

Referenced by gen_builtin_conversions(), get_composite_pointer_type(), is_covariant_or_same(), Expr_annotator::process_member_access(), Expr_annotator::process_pm_expr(), and Expr_annotator::visit_name().

Symbol_pair Class_symbol::lookup_helper std::string    name const [inline]
 

Definition at line 244 of file class.h.

References Symbol_table::get_instance(), Symbol_name::get_mangled_scope_from_symbol(), Symbol_name::get_mangled_symbol_name(), and Symbol::get_name().

Referenced by finish_definition(), Init_handler::get_default_initializer_for_type(), implicit_assignment_operator_style(), implicit_copy_ctor_is_const(), Class_scope::lookup_here(), Init_handler::make_constructor_call(), Class_op_lookup_helper::predicate(), Class_name_lookup_helper::predicate(), and Expr_annotator::visit_assign().

void Class_symbol::maybe_add_vbc Class_symbol *    sym [private]
 

Add virtual base class, if it is not already there.

Definition at line 106 of file class.cc.

References base_classes, compile_error(), Symbol::get_name(), and virtual_base_classes.

Referenced by add_base_class().

Class_symbol::members_t::const_iterator Class_symbol::mem_begin   const [inline]
 

Definition at line 253 of file class.h.

References members.

Referenced by implicit_assignment_operator_style(), implicit_copy_ctor_is_const(), Init_handler::process_class(), and process_initializers().

Class_symbol::members_t::const_iterator Class_symbol::mem_end   const [inline]
 

Definition at line 260 of file class.h.

References members.

Referenced by implicit_assignment_operator_style(), implicit_copy_ctor_is_const(), Init_handler::process_class(), and process_initializers().

void Class_symbol::start_definition std::string    basename
 

Start class definition.

Definition at line 174 of file class.cc.

References Class_scope::add_symbol(), Symbol_table::get_instance(), Type_symbol::get_type(), and Symbol_table::set_peer().

Referenced by parse_class().

Class_symbol::bases_t::const_iterator Class_symbol::vbc_begin   const [inline]
 

Definition at line 267 of file class.h.

References virtual_base_classes.

Referenced by process_initializers().

Class_symbol::bases_t::const_iterator Class_symbol::vbc_end   const [inline]
 

Definition at line 274 of file class.h.

References virtual_base_classes.

Referenced by process_initializers().


Friends And Related Function Documentation

friend class Class_lookup_helper [friend]
 

Definition at line 71 of file class.h.

friend class Class_scope [friend]
 

Definition at line 72 of file class.h.

Referenced by get_scope().


Member Data Documentation

bool Class_symbol::aggregate [private]
 

Definition at line 69 of file class.h.

Referenced by add_base_class(), finish_definition(), and is_aggregate().

bases_t Class_symbol::base_classes [private]
 

Definition at line 65 of file class.h.

Referenced by add_base_class(), Class_lookup_helper::add_class(), base_begin(), base_end(), dump(), enumerate_base_classes(), implicit_assignment_operator_style(), implicit_copy_ctor_is_const(), is_base_class_of(), and maybe_add_vbc().

Abstract_scope* Class_symbol::in_scope [private]
 

Definition at line 61 of file class.h.

Kind Class_symbol::k [private]
 

Definition at line 60 of file class.h.

Referenced by get_kind().

memfuns_t Class_symbol::member_functions [private]
 

Definition at line 67 of file class.h.

Referenced by Class_scope::add_function_decl(), and finish_definition().

members_t Class_symbol::members [private]
 

Definition at line 66 of file class.h.

Referenced by Class_scope::add_variable(), mem_begin(), and mem_end().

bool Class_symbol::pod [private]
 

Definition at line 69 of file class.h.

Referenced by add_base_class(), Class_scope::add_function_decl(), Class_scope::add_variable(), finish_definition(), and is_pod().

std::string Class_symbol::real_name [private]
 

Definition at line 62 of file class.h.

Referenced by get_real_name().

bases_t Class_symbol::virtual_base_classes [private]
 

Definition at line 65 of file class.h.

Referenced by add_base_class(), Class_lookup_helper::add_class(), dump(), enumerate_base_classes(), Class_lookup_helper::finish(), implicit_assignment_operator_style(), implicit_copy_ctor_is_const(), is_base_class_of(), maybe_add_vbc(), vbc_begin(), and vbc_end().


The documentation for this class was generated from the following files:
Generated on Mon Feb 10 17:35:23 2003 for VFiasco Semantics Compiler by doxygen1.2.15