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

Function_signature Class Reference

#include <function.h>

Inheritance diagram for Function_signature:

Inheritance graph
[legend]
Collaboration diagram for Function_signature:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::vector< Variable_symbol * > Par_vec

Public Methods

 Function_signature (Type t, Type this_type, Type call_type, Storage_class_specifier sc, Function_specifier_set f, Function_symbol *backlink)
 Construct function signature. More...

Type get_return_type () const
 Get return type. More...

Type get_proto_type () const
 Get proto-type (args + return type). More...

Type get_call_type () const
 Get type used for calling this function. More...

Type get_this_type () const
 Get type of *this. More...

bool has_pointer_type (Type t) const
 True iff this function signature can be stored in a pointer of type t. More...

Type get_pointer_type () const
 Get type of expression "&this_function". More...

Storage_class_specifier get_storage_specifier () const
 Get storage specifier. More...

Function_specifier_set get_function_specifiers () const
 Get list of function specifiers. More...

void merge_fspec (Function_specifier_set fspec)
 Merge function specifiers. More...

bool is_builtin () const
 "Builtin" flag. More...

void set_builtin ()
bool is_generated () const
 "Generated" flag. More...

void set_generated ()
Function_symbolget_function () const
 Get function symbol of which this is an instance. More...

Ptreeget_body () const
 Get body of this function. More...

Ptreeget_initializers () const
 Get initializers. More...

void set_body (Ptree *tree, Ptree *init)
 Set body and initializers. More...

Function_signature::Par_vec::const_iterator par_begin () const
Function_signature::Par_vec::const_iterator par_end () const
void add_parameter (Variable_symbol *vsym)
Symbol::Kind get_kind () const
void dump (std::ostream &os)
 Dump symbol on /out/. More...


Static Public Methods

Function_signature * make_builtin (Type t)
 Make a builtin function signature. More...


Private Attributes

Type proto_type
Type this_type
Type call_type
Storage_class_specifier storage_spec
Function_specifier_set function_spec
bool builtin
bool generated
Function_symbolbacklink
Ptreedefinition
Ptreeinitializers
Par_vec parameters

Member Typedef Documentation

typedef std::vector<Variable_symbol*> Function_signature::Par_vec
 

Definition at line 47 of file function.h.


Constructor & Destructor Documentation

Function_signature::Function_signature Type    t,
Type    this_type,
Type    call_type,
Storage_class_specifier    sc,
Function_specifier_set    f,
Function_symbol   backlink
 

Construct function signature.

Parameters:
t  type, for example "void (*)(int)".
this_type  type of this pointer, with possible qualifications, e.g. "const X" for a const member function of X; invalid if function is static or non-member.
sc  storage class (member, extern, static)
f  function specifiers (inline, virtual, ...)

Definition at line 245 of file function.cc.

References Function_specifier_set, Type::is_valid(), s_Member, and Storage_class_specifier.

Referenced by make_builtin().


Member Function Documentation

void Function_signature::add_parameter Variable_symbol   vsym
 

Definition at line 373 of file function.cc.

References get_proto_type(), Variable_symbol::get_type(), Type::is_same_unqualified_type(), and parameters.

Referenced by Block_scope::add_variable().

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

Dump symbol on /out/.

Derived classes can override this to add own information.

Reimplemented from Symbol.

Definition at line 390 of file function.cc.

References definition, Symbol::dump(), function_spec, get_function_specifier_name(), Type::get_human_readable_type(), get_storage_specifier_name(), Symbol_table::has_dump_flag(), initializers, is_generated(), Type::is_valid(), print_annotated_tree(), proto_type, storage_spec, and this_type.

Ptree * Function_signature::get_body   const [inline]
 

Get body of this function.

Precondition:
is_defined().

Definition at line 292 of file function.h.

References definition, and Symbol::is_defined().

Type Function_signature::get_call_type   const [inline]
 

Get type used for calling this function.

Definition at line 218 of file function.h.

References call_type.

Referenced by Expr_annotator::do_funcall(), and make_name().

Function_symbol * Function_signature::get_function   const [inline]
 

Get function symbol of which this is an instance.

Definition at line 284 of file function.h.

References backlink.

Referenced by Function_body_queue::add_function(), Overload_candidate::fill_in_tree(), make_name(), process_function_body(), and process_initializers().

Function_specifier_set Function_signature::get_function_specifiers   const [inline]
 

Get list of function specifiers.

Definition at line 243 of file function.h.

References function_spec.

Referenced by gen_constructors().

Ptree * Function_signature::get_initializers   const [inline]
 

Get initializers.

Only valid for constructors. The initializer Ptree has no direct mapping into C++. It is a list of elements of the form NonLeaf [Symbol, Type] Name = Initializer-expression-or-null-if-uninitialized

Definition at line 307 of file function.h.

References initializers, and Symbol::is_defined().

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

Implements Symbol.

Definition at line 382 of file function.cc.

References Symbol::k_Function.

Type Function_signature::get_pointer_type   const
 

Get type of expression "&this_function".

Definition at line 322 of file function.cc.

References Type::is_valid(), Type::make_member_type(), proto_type, and this_type.

Referenced by Expr_annotator::visit_unary().

Type Function_signature::get_proto_type   const [inline]
 

Get proto-type (args + return type).

Definition at line 210 of file function.h.

References proto_type.

Referenced by Overload_resolver::add_builtin_incdec(), add_parameter(), Overload_resolver::add_signature(), Function_symbol::add_signature(), Overload_resolver::dump(), ICS_Step::dump(), gen_constructors(), Class_symbol::get_copy_ctor(), get_return_type(), Function_symbol::get_type(), Class_symbol::implicit_assignment_operator_style(), and Class_symbol::implicit_copy_ctor_is_const().

Type Function_signature::get_return_type   const
 

Get return type.

Definition at line 276 of file function.cc.

References get_proto_type(), and Type::get_return_type().

Referenced by Expr_annotator::do_funcall(), Expr_annotator::visit_array(), Expr_annotator::visit_arrowmember(), Expr_annotator::visit_assign(), Expr_annotator::visit_comma(), Expr_annotator::visit_postfix(), Annotator::visit_return(), and Expr_annotator::visit_unary().

Storage_class_specifier Function_signature::get_storage_specifier   const [inline]
 

Get storage specifier.

One of s_Static/s_Member/s_Extern.

Definition at line 235 of file function.h.

References storage_spec.

Referenced by Function_symbol::add_signature(), Overload_resolver::add_signature_with_type(), Expr_annotator::do_funcall(), Overload_candidate::fill_in_tree(), process_function_body(), and Expr_annotator::visit_name().

Type Function_signature::get_this_type   const [inline]
 

Get type of *this.

(The actual type of /this/ is q = get_this_type().make_pointer_type().with_qualifier(q_Const);)

Definition at line 227 of file function.h.

References this_type.

Referenced by Function_symbol::add_signature(), Overload_resolver::add_signature_with_type(), process_function_body(), and process_initializers().

bool Function_signature::has_pointer_type Type    t const
 

True iff this function signature can be stored in a pointer of type t.

E.g., for a function "void p(int)", this returns true if and only if t is "void (*)(int)". For member functions, we need some more elaborate conditions to handle base class relationships, i.e. a "void (Base::*)(int)" can be stored in "void (Derived::*)(int)".

Definition at line 289 of file function.cc.

References Type::get_basis_type(), Type::get_class_type(), Type::get_kind(), Type::get_member_type(), Type::get_type_symbol(), Type::get_unqualified_type(), Type::is_more_qualified_than(), Type::is_same_unqualified_type(), Type::is_valid(), Type::k_Function, Type::k_Member, Type::k_Pointer, proto_type, s_Member, storage_spec, and this_type.

bool Function_signature::is_builtin   const [inline]
 

"Builtin" flag.

True iff this is a builtin operator. Only used during overload resolution.

Definition at line 252 of file function.h.

References builtin.

Referenced by Expr_annotator::do_funcall(), Expr_annotator::visit_array(), Expr_annotator::visit_assign(), Expr_annotator::visit_postfix(), and Expr_annotator::visit_unary().

bool Function_signature::is_generated   const [inline]
 

"Generated" flag.

True iff this is a generated function.

Definition at line 267 of file function.h.

References generated.

Referenced by dump().

Function_signature * Function_signature::make_builtin Type    t [static]
 

Make a builtin function signature.

These are used for overload resolution, to resolve builtin operators. This is just a handy shortcut.

Definition at line 264 of file function.cc.

References f_None, Function_signature(), s_Extern, set_builtin(), and Symbol::set_name().

Referenced by Overload_resolver::add_builtin_binary_ops(), Overload_resolver::add_builtin_incdec(), Overload_resolver::add_builtin_unary_ops(), Expr_annotator::do_funcall(), and Expr_annotator::visit_unary().

void Function_signature::merge_fspec Function_specifier_set    fspec
 

Merge function specifiers.

Definition at line 335 of file function.cc.

References compile_error(), f_Inline, function_spec, and Function_specifier_set.

Referenced by Class_scope::add_function_implementation(), and Function_symbol::add_signature().

Function_signature::Par_vec::const_iterator Function_signature::par_begin   const
 

Definition at line 357 of file function.cc.

References parameters.

Function_signature::Par_vec::const_iterator Function_signature::par_end   const
 

Definition at line 365 of file function.cc.

References parameters.

void Function_signature::set_body Ptree   tree,
Ptree   init
 

Set body and initializers.

See get_initializers() and get_body() for details.

Definition at line 347 of file function.cc.

References definition, initializers, Symbol::set_status(), and Symbol::st_Defined.

Referenced by process_function_body().

void Function_signature::set_builtin   [inline]
 

Definition at line 259 of file function.h.

References builtin.

Referenced by make_builtin().

void Function_signature::set_generated   [inline]
 

Definition at line 274 of file function.h.

References generated, Symbol::is_declared(), Symbol::set_status(), and Symbol::st_Declared.

Referenced by Class_symbol::finish_definition().


Member Data Documentation

Function_symbol* Function_signature::backlink [private]
 

Definition at line 42 of file function.h.

Referenced by get_function().

bool Function_signature::builtin [private]
 

Definition at line 40 of file function.h.

Referenced by is_builtin(), and set_builtin().

Type Function_signature::call_type [private]
 

Definition at line 36 of file function.h.

Referenced by get_call_type().

Ptree* Function_signature::definition [private]
 

Definition at line 43 of file function.h.

Referenced by dump(), get_body(), and set_body().

Function_specifier_set Function_signature::function_spec [private]
 

Definition at line 39 of file function.h.

Referenced by dump(), get_function_specifiers(), and merge_fspec().

bool Function_signature::generated [private]
 

Definition at line 41 of file function.h.

Referenced by is_generated(), and set_generated().

Ptree* Function_signature::initializers [private]
 

Definition at line 44 of file function.h.

Referenced by dump(), get_initializers(), and set_body().

Par_vec Function_signature::parameters [private]
 

Definition at line 50 of file function.h.

Referenced by add_parameter(), par_begin(), and par_end().

Type Function_signature::proto_type [private]
 

Definition at line 32 of file function.h.

Referenced by dump(), get_pointer_type(), get_proto_type(), and has_pointer_type().

Storage_class_specifier Function_signature::storage_spec [private]
 

Definition at line 38 of file function.h.

Referenced by dump(), get_storage_specifier(), and has_pointer_type().

Type Function_signature::this_type [private]
 

Definition at line 34 of file function.h.

Referenced by dump(), get_pointer_type(), get_this_type(), and has_pointer_type().


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