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

Init_handler Class Reference

#include <init_handler.h>

Collaboration diagram for Init_handler:

Collaboration graph
[legend]
List of all members.

Public Methods

 Init_handler (Abstract_scope *scope, Ptree *tree, bool zero_init)
 Create an Init_handler. More...

 ~Init_handler ()
Ptreemake_constructor_call (Type t, Ptree *args)
 Build a constructor call for type T, with given args. More...

Ptreeprocess_initializer (Type t)
 Main entry point. More...

Ptreeget_default_initializer_for_type (Type t)
 Return a default initializer for type t. More...


Private Methods

Ptreeprocess_brace (Type t, Init_reader *reader)
 Process a brace initializer. More...

Ptreeprocess_array (Type t, Init_reader *reader)
Ptreeprocess_class (Class_symbol *csym, Init_reader *reader)

Private Attributes

Ptreetree
Abstract_scopescope
bool zero_init

Constructor & Destructor Documentation

Init_handler::Init_handler Abstract_scope   scope,
Ptree   tree,
bool    zero_init
 

Create an Init_handler.

Parameters:
scope  the scope
tree  the tree. Either [= expr] or [( arglist )].
zero_init  true iff we're doing default/zero initialisation, false if not. This is true for static variables etc., and false for automatic variables.

Definition at line 111 of file init_handler.cc.

Init_handler::~Init_handler  
 

Definition at line 118 of file init_handler.cc.


Member Function Documentation

Ptree * Init_handler::get_default_initializer_for_type Type    t
 

Return a default initializer for type t.

Definition at line 399 of file init_handler.cc.

References Overload_resolver::add_function(), compile_error(), compile_warning(), Symbol_name::CONSTRUCTOR_NAME, Overload_candidate::fsig, generate_implicit_conversion(), Overload_resolver::get_best(), Type::get_human_readable_type(), Type::get_kind(), Expr_result::get_tree(), Type::get_type_symbol(), Class_symbol::is_aggregate(), Type::is_class_type(), Type::is_scalar_type(), Type::k_Array, Type::k_Reference, Expr_result::k_RValue, Class_symbol::lookup_helper(), make_name(), Implicit_conversion::make_tree(), process_class(), Symbol_pair::untag, and zero_init.

Referenced by process_brace(), and process_initializer().

Ptree * Init_handler::make_constructor_call Type    t,
Ptree   args
 

Build a constructor call for type T, with given args.

Definition at line 158 of file init_handler.cc.

References Annotated_funcall_maker::add_arg(), Overload_resolver::add_function(), compile_error(), Symbol_name::CONSTRUCTOR_NAME, Ptree::First(), Overload_candidate::fsig, generate_implicit_conversion(), Overload_resolver::get_arg(), Overload_resolver::get_arg_count(), Overload_resolver::get_best(), Type::get_kind(), Symbol::get_name(), Expr_result::get_tree(), Type::get_type_symbol(), Source::instance(), Type::is_class_type(), Type::is_scalar_type(), Type::k_Reference, Ptree::Length(), Class_symbol::lookup_helper(), Annotated_funcall_maker::make_funcall(), make_name(), make_static_leaf(), Implicit_conversion::make_tree(), scope, and Symbol_pair::untag.

Referenced by process_initializer().

Ptree * Init_handler::process_array Type    t,
Init_reader   reader
[private]
 

Definition at line 345 of file init_handler.cc.

References Init_maker::add(), compile_warning(), Init_reader::empty(), Init_reader::get_nondestructive(), Init_maker::make_init(), and process_brace().

Referenced by process_brace().

Ptree * Init_handler::process_brace Type    t,
Init_reader   reader
[private]
 

Process a brace initializer.

Parameters:
t  target type
reader  source for initializers

Definition at line 266 of file init_handler.cc.

References compile_error(), compile_warning(), generate_implicit_conversion(), Init_reader::get(), Type::get_basis_type(), get_default_initializer_for_type(), Type::get_kind(), Symbol::get_name(), Init_reader::get_nondestructive(), get_string_literal(), Expr_result::get_tree(), Type::get_type_symbol(), Source::instance(), Class_symbol::is_aggregate(), is_character_type(), Type::is_class_type(), Init_reader::is_compound(), Type::is_scalar_type(), Ptree::IsLeaf(), Type::k_Array, Implicit_conversion::make_tree(), process_array(), process_class(), scope, Ptree::Second(), and tree.

Referenced by process_array(), process_class(), and process_initializer().

Ptree * Init_handler::process_class Class_symbol   csym,
Init_reader   reader
[private]
 

Definition at line 360 of file init_handler.cc.

References Init_maker::add(), generate_implicit_conversion(), Init_reader::get(), Class_symbol::get_kind(), Init_reader::get_nondestructive(), Expr_result::get_tree(), Variable_symbol::get_type(), Type_symbol::get_type(), Source::instance(), Init_reader::is_compound(), Variable_symbol::is_member_variable(), Symbol::k_Union, Init_maker::make_init(), Implicit_conversion::make_tree(), Class_symbol::mem_begin(), Class_symbol::mem_end(), process_brace(), and scope.

Referenced by get_default_initializer_for_type(), and process_brace().

Ptree * Init_handler::process_initializer Type    t
 

Main entry point.

Parse our tree as an initializer for type T. Returns the initializer:

  • a brace list for aggregates
  • a string literal for char arrays
  • an expression for others
  • a constructor call for classes

Definition at line 217 of file init_handler.cc.

References bogus_ptree_error(), compile_error(), Ptree::Eq(), expect_ptree(), Ptree::First(), Type::get_basis_type(), get_default_initializer_for_type(), Type::get_kind(), get_string_literal(), is_character_type(), Type::is_class_type(), Type::is_scalar_type(), Type::k_Array, make_constructor_call(), process_brace(), Ptree::Second(), Ptree::Third(), and tree.


Member Data Documentation

Abstract_scope* Init_handler::scope [private]
 

Definition at line 30 of file init_handler.h.

Referenced by make_constructor_call(), process_brace(), and process_class().

Ptree* Init_handler::tree [private]
 

Definition at line 29 of file init_handler.h.

Referenced by process_brace(), and process_initializer().

bool Init_handler::zero_init [private]
 

Definition at line 31 of file init_handler.h.

Referenced by get_default_initializer_for_type().


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