#include <function.h>
Inheritance diagram for Function_signature:
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_symbol * | get_function () const |
Get function symbol of which this is an instance. More... | |
Ptree * | get_body () const |
Get body of this function. More... | |
Ptree * | get_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_symbol * | backlink |
Ptree * | definition |
Ptree * | initializers |
Par_vec | parameters |
|
Definition at line 47 of file function.h. |
|
Construct function signature.
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(). |
|
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(). |
|
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. |
|
Get body of this function.
Definition at line 292 of file function.h. References definition, and Symbol::is_defined(). |
|
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(). |
|
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(). |
|
Get list of function specifiers.
Definition at line 243 of file function.h. References function_spec. Referenced by gen_constructors(). |
|
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(). |
|
Implements Symbol. Definition at line 382 of file function.cc. References Symbol::k_Function. |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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. |
|
"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(). |
|
"Generated" flag. True iff this is a generated function. Definition at line 267 of file function.h. References generated. Referenced by dump(). |
|
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(). |
|
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(). |
|
Definition at line 357 of file function.cc. References parameters. |
|
Definition at line 365 of file function.cc. References parameters. |
|
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(). |
|
Definition at line 259 of file function.h. References builtin. Referenced by make_builtin(). |
|
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(). |
|
Definition at line 42 of file function.h. Referenced by get_function(). |
|
Definition at line 40 of file function.h. Referenced by is_builtin(), and set_builtin(). |
|
Definition at line 36 of file function.h. Referenced by get_call_type(). |
|
Definition at line 43 of file function.h. |
|
Definition at line 39 of file function.h. Referenced by dump(), get_function_specifiers(), and merge_fspec(). |
|
Definition at line 41 of file function.h. Referenced by is_generated(), and set_generated(). |
|
Definition at line 44 of file function.h. Referenced by dump(), get_initializers(), and set_body(). |
|
Definition at line 50 of file function.h. Referenced by add_parameter(), par_begin(), and par_end(). |
|
Definition at line 32 of file function.h. Referenced by dump(), get_pointer_type(), get_proto_type(), and has_pointer_type(). |
|
Definition at line 38 of file function.h. Referenced by dump(), get_storage_specifier(), and has_pointer_type(). |
|
Definition at line 34 of file function.h. Referenced by dump(), get_pointer_type(), get_this_type(), and has_pointer_type(). |