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

Type Class Reference

Throwaway type representation. More...

#include <type_rep.h>

List of all members.

Public Types

enum  Qualifier { q_Const, q_Volatile, q_Restrict }
enum  Kind {
  k_Fundamental, k_Pointer = 'P', k_Reference = 'R', k_Function = 'F',
  k_Array = 'A', k_Member = 'M', k_Userdef = 'Q', k_Ellipsis = 'E',
  k_Template = 'T', k_Nothing = 'O'
}

Public Methods

bool is_qualified (Qualifier q) const
bool is_qualified () const
void add_qualifier (Qualifier q)
void remove_qualifier (Qualifier q)
bool is_valid () const
void copy_qualifiers (const Type &other)
const std::string & get_encoded_type () const
Type get_unqualified_type () const
bool operator== (const Type &rhs) const
bool operator!= (const Type &rhs) const
bool is_more_qualified_than (const Type &other) const
bool is_same_qualified_as (const Type &other) const
bool is_same_unqualified_type (const Type &other) const
 Type ()
 Create an empty, invalid type. More...

 Type (std::string encoded)
 Create a type containing the specified encoded signature. More...

Type::Kind get_kind () const
 Return kind of this type. More...

Type make_pointer_type () const
 Create pointer type (pointer-to-this). More...

Type make_reference_type () const
 Create reference type (reference-to-this). More...

Type make_array_type (Ptree *dimension) const
 Create array type (array[dimension]-of-this). More...

Type make_member_type (Type membertype) const
 Create member type (member-membertype-of-this). More...

Type get_basis_type () const
 Given a type "reference-to-T", "pointer-to-T" or "array-of-T", return the T. More...

Type sans_reference () const
 Returns this type with reference removed. More...

Type sans_array () const
Type get_class_type () const
 Given a type "pointer-to-member-of-CLASS-which-has-type-T", return CLASS. More...

Type get_member_type () const
 Given a type "pointer-to-member-of-CLASS-which-has-type-T", return T. More...

Type get_return_type () const
 Given a type "function returning T", return T. More...

std::string get_function_signature () const
 Given a function type, return its signature. More...

Type get_function_arg (int n) const
 Given a type "function(a0,a1,a2...) returning T", return a_i. More...

int get_num_function_args () const
 Given a type "function(a0..a_n-1)", return n. More...

int get_template_argindex () const
 Given type "N'th template argument", return N. More...

std::string get_human_readable_type () const
 Return a human-readable description of this type. More...

bool is_void () const
 True iff this type is void. More...

bool is_float () const
 True iff this type is a floating-point type. More...

bool is_int () const
 True iff this type is an integral type. More...

bool is_complete () const
 True iff this type is complete. More...

bool is_object_type () const
 Object types, 3.9p9. More...

bool is_arithmetic_type () const
 Arithmetic types, 3.9.1p8. More...

bool is_scalar_type () const
 Scalar types, 3.9p10. More...

bool is_pod () const
 True if type is POD (3.9p10). More...

bool is_aggregate () const
bool is_compound_type () const
 Compound types, 3.9.2. More...

bool is_enum_type () const
bool is_class_type () const
Type_symbolget_type_symbol () const
 Given a user-defined type, return the corresponding Type_symbol. More...

Type with_qualifier (Type::Qualifier q) const
 Return this type, with qualifier /q/ added. More...

Type with_first_arg (Type t) const
 When this is "function-taking-args-a,b,c", return "function-taking-args-t,a,b,c". More...

Type with_qualifiers (const Type &other) const
 Return this type, with the qualifiers from /other/ added. More...

Type get_promoted_integer () const
 Integral promotions, 4.5. More...

bool is_qualification_convertible_to (Type t) const
 True iff this type can be qualification-converted to /t/. More...


Static Public Methods

Type get_named_type (std::string name)
 Create type symbol for type with mangled name /name/. More...


Static Public Attributes

const int ignore_qual = 0

Private Methods

 Type (std::string code, int qualifiers)
std::string encode_qualifiers (std::string prefix) const
 Internal: construct a new type. More...


Static Private Methods

std::string eat_type (std::string s)
 Given a string <Type>NNN, return NNN. More...


Private Attributes

std::string code
int qualifiers

Friends

class Function_type_maker


Detailed Description

Throwaway type representation.

In the future, this should probably be replaced by a proper dynamic data structure which allows easier representation of some subtleties.

How gcc does it: every type has a "main variant", of these we have sub-variants (cv-qualified types) which are created on demand. In addition, we have derived types (ref/ptr/array) for each.

Definition at line 75 of file type_rep.h.


Member Enumeration Documentation

enum Type::Kind
 

Enumeration values:
k_Fundamental 
k_Pointer 
k_Reference 
k_Function 
k_Array 
k_Member 
k_Userdef 
k_Ellipsis 
k_Template 
k_Nothing 

Definition at line 85 of file type_rep.h.

Referenced by get_kind(), and is_qualification_convertible_to().

enum Type::Qualifier
 

Enumeration values:
q_Const  "const".
q_Volatile  "volatile".
q_Restrict  "restrict".

Definition at line 80 of file type_rep.h.

Referenced by add_qualifier(), is_qualified(), remove_qualifier(), and with_qualifier().


Constructor & Destructor Documentation

Type::Type  
 

Create an empty, invalid type.

Postcondition:
!Type().is_valid()

Definition at line 22 of file type_rep.cc.

Referenced by get_basis_type(), get_class_type(), get_function_arg(), get_member_type(), get_named_type(), get_promoted_integer(), get_return_type(), get_unqualified_type(), make_array_type(), make_member_type(), make_pointer_type(), make_reference_type(), with_qualifier(), and with_qualifiers().

Type::Type std::string    encoded
 

Create a type containing the specified encoded signature.

This is used to construct types internally and should not be called by user code. Still public for flexibility.

Definition at line 32 of file type_rep.cc.

References add_qualifier(), code, q_Const, q_Restrict, and q_Volatile.

Type::Type std::string    code,
int    qualifiers
[private]
 

Definition at line 53 of file type_rep.cc.


Member Function Documentation

void Type::add_qualifier Qualifier    q [inline]
 

Definition at line 101 of file type_rep.h.

References Qualifier, and qualifiers.

Referenced by Class_symbol::finish_definition(), parse_qualifier(), Expr_annotator::process_member_access(), Type(), and Expr_annotator::visit_name().

void Type::copy_qualifiers const Type &    other [inline]
 

Definition at line 105 of file type_rep.h.

References qualifiers.

Referenced by Function_symbol::add_signature(), Implicit_conversion::convert_to_rvalue(), Simple_declaration_reader::declare_variable(), and Type_reader::Type_reader().

std::string Type::eat_type std::string    s [static, private]
 

Given a string <Type>NNN, return NNN.

Definition at line 246 of file type_rep.cc.

References compile_error().

Referenced by get_class_type(), get_function_arg(), get_function_signature(), get_member_type(), get_num_function_args(), and get_return_type().

std::string Type::encode_qualifiers std::string    prefix const [private]
 

Internal: construct a new type.

"prefix" is the new prefix (a Kind maybe)

Definition at line 86 of file type_rep.cc.

References code, is_qualified(), q_Const, q_Restrict, and q_Volatile.

Referenced by Function_type_maker::add_parameter(), make_array_type(), Function_type_maker::make_function_type(), make_member_type(), make_pointer_type(), make_reference_type(), and with_first_arg().

Type Type::get_basis_type   const
 

Given a type "reference-to-T", "pointer-to-T" or "array-of-T", return the T.

Definition at line 124 of file type_rep.cc.

References code, get_kind(), k_Array, k_Pointer, k_Reference, and Type().

Referenced by Overload_resolver::add_builtin_incdec(), Function_type_maker::add_parameter(), Expr_result::adjust_reference(), binary_addeq_predicate(), binary_inteq_predicate(), binary_multeq_predicate(), check_ptr_arith(), Expr_result::convert_to_pointer(), Implicit_conversion::convert_to_rvalue(), Expr_annotator::do_funcall(), gen_builtin_conversions(), gen_candidates(), get_composite_pointer_type(), get_human_readable_type(), get_merged_cv_type(), Function_signature::has_pointer_type(), Class_symbol::implicit_assignment_operator_style(), Class_symbol::implicit_copy_ctor_is_const(), index_predicate(), is_covariant_or_same(), is_pod(), is_qualification_convertible_to(), Init_handler::process_brace(), Init_handler::process_initializer(), Expr_annotator::process_unary_operator(), sans_array(), sans_reference(), Implicit_conversion::scs_is_better_than(), Expr_result::set_value(), try_reinterpret_cast(), Expr_annotator::try_static_cast(), unary_delete_or_arrow_predicate(), unary_deref_predicate(), Expr_annotator::visit_array(), Expr_annotator::visit_arrowmember(), Expr_annotator::visit_delete(), Expr_annotator::visit_new(), Expr_annotator::visit_pm(), and Expr_annotator::visit_postfix().

Type Type::get_class_type   const
 

Given a type "pointer-to-member-of-CLASS-which-has-type-T", return CLASS.

Definition at line 158 of file type_rep.cc.

References code, eat_type(), get_kind(), k_Member, and Type().

Referenced by gen_builtin_conversions(), get_composite_mptr_type(), get_human_readable_type(), get_merged_cv_type(), Function_signature::has_pointer_type(), is_qualification_convertible_to(), Expr_annotator::process_pm_expr(), Implicit_conversion::scs_is_better_than(), try_reinterpret_cast(), and Expr_annotator::try_static_cast().

const std::string& Type::get_encoded_type   const [inline]
 

Definition at line 107 of file type_rep.h.

References code.

Referenced by Function_symbol::add_signature(), Overload_resolver::dump(), ICS_Step::dump(), Symbol_name::get_mangled_function_name(), make_declaration(), make_sizeof_expr(), print_annotated_tree(), and Expr_annotator::visit_new().

Type Type::get_function_arg int    n const
 

Given a type "function(a0,a1,a2...) returning T", return a_i.

Definition at line 206 of file type_rep.cc.

References code, eat_type(), get_kind(), k_Function, and Type().

Referenced by Overload_resolver::add_signature_with_type(), gen_constructors(), Class_symbol::get_copy_ctor(), get_human_readable_type(), Class_symbol::implicit_assignment_operator_style(), and Class_symbol::implicit_copy_ctor_is_const().

std::string Type::get_function_signature   const
 

Given a function type, return its signature.

The signature is an opaque string which encodes the parameters.

Definition at line 193 of file type_rep.cc.

References code, eat_type(), get_kind(), and k_Function.

Referenced by Class_scope::add_function_decl(), Function_symbol::add_signature(), and Symbol_name::get_mangled_function_name().

std::string Type::get_human_readable_type   const
 

Return a human-readable description of this type.

Definition at line 315 of file type_rep.cc.

References code, get_basis_type(), get_class_type(), get_function_arg(), get_kind(), get_member_type(), get_num_function_args(), get_return_type(), is_qualified(), k_Array, k_Ellipsis, k_Function, k_Fundamental, k_Member, k_Nothing, k_Pointer, k_Reference, k_Template, k_Userdef, q_Const, q_Restrict, and q_Volatile.

Referenced by Expr_result::convert_to_bool(), Simple_declaration_reader::declare_variable(), Expr_annotator::do_funcall(), Variable_symbol::dump(), Typedef_symbol::dump(), ICS_Step::dump(), Function_signature::dump(), Init_handler::get_default_initializer_for_type(), Expr_annotator::visit_array(), Expr_annotator::visit_assign(), Expr_annotator::visit_new(), Annotator::visit_return(), and Annotator::visit_switch().

Type::Kind Type::get_kind   const
 

Return kind of this type.

Definition at line 72 of file type_rep.cc.

References code, k_Fundamental, and Kind.

Referenced by Overload_resolver::add_builtin_incdec(), Function_type_maker::add_parameter(), Overload_resolver::add_signature_with_type(), Namespace_scope::add_variable(), Class_scope::add_variable(), Expr_result::adjust_reference(), binary_addeq_predicate(), binary_inteq_predicate(), binary_multeq_predicate(), class_or_null(), Implicit_conversion::convert_reference(), Expr_result::convert_to_bool(), Expr_result::convert_to_fpointer(), Expr_result::convert_to_pointer(), Implicit_conversion::convert_to_rvalue(), Expr_result::convert_to_rvalue(), Typedef_declaration_reader::declare_variable(), Simple_declaration_reader::declare_variable(), Expr_annotator::do_funcall(), do_mptr_arith_conversions(), do_pointer_arith_conversions(), enumerate_conversion_ops(), fundamental_conversion_type(), gen_builtin_conversions(), gen_candidates(), gen_constructors(), get_basis_type(), get_class_type(), get_composite_mptr_type(), get_composite_pointer_type(), Class_symbol::get_copy_ctor(), Init_handler::get_default_initializer_for_type(), get_function_arg(), get_function_signature(), Function_symbol::get_function_signature(), get_human_readable_type(), get_member_type(), get_merged_cv_type(), get_num_function_args(), get_return_type(), get_template_argindex(), get_type_symbol(), Function_signature::has_pointer_type(), Class_symbol::implicit_assignment_operator_style(), index_predicate(), is_aggregate(), is_class_type(), is_complete(), is_compound_type(), is_covariant_or_same(), is_enum_type(), is_int(), is_object_type(), is_pod(), is_qualification_convertible_to(), is_scalar_type(), Init_handler::make_constructor_call(), make_sizeof_expr(), Declaration_reader::parse_declarator_internal(), Expr_annotator::process_binary_operator(), Init_handler::process_brace(), Init_handler::process_initializer(), Expr_annotator::process_pm_expr(), Expr_annotator::process_unary_operator(), sans_array(), sans_reference(), Implicit_conversion::scs_is_better_than(), Expr_result::set_value(), try_reinterpret_cast(), Expr_annotator::try_static_cast(), Type_reader::Type_reader(), unary_delete_or_arrow_predicate(), unary_deref_predicate(), unary_plus_predicate(), Expr_annotator::visit_array(), Expr_annotator::visit_arrowmember(), Expr_annotator::visit_assign(), Expr_annotator::visit_comma(), Expr_annotator::visit_cond(), Expr_annotator::visit_delete(), Expr_annotator::visit_infix(), Expr_annotator::visit_new(), Expr_annotator::visit_pm(), Expr_annotator::visit_postfix(), Expr_annotator::visit_unary(), and with_first_arg().

Type Type::get_member_type   const
 

Given a type "pointer-to-member-of-CLASS-which-has-type-T", return T.

Definition at line 169 of file type_rep.cc.

References code, eat_type(), get_kind(), k_Member, and Type().

Referenced by gen_builtin_conversions(), get_composite_mptr_type(), get_human_readable_type(), get_merged_cv_type(), Function_signature::has_pointer_type(), is_qualification_convertible_to(), Expr_annotator::process_pm_expr(), try_reinterpret_cast(), and Expr_annotator::try_static_cast().

Type Type::get_named_type std::string    name [static]
 

Create type symbol for type with mangled name /name/.

Definition at line 61 of file type_rep.cc.

References Type().

Referenced by Type_symbol::get_type().

int Type::get_num_function_args   const
 

Given a type "function(a0..a_n-1)", return n.

Definition at line 219 of file type_rep.cc.

References code, eat_type(), get_kind(), and k_Function.

Referenced by Overload_resolver::add_signature_with_type(), Simple_declaration_reader::declare_variable(), gen_constructors(), Class_symbol::get_copy_ctor(), and get_human_readable_type().

Type Type::get_promoted_integer   const
 

Integral promotions, 4.5.

Returns the type after integral promotions, with cv-qualifiers removed. This also "expands" enums.

Definition at line 513 of file type_rep.cc.

References code, Symbol::get_kind(), get_type_symbol(), int_type(), Symbol::k_Enum, Type(), and uint_type().

Referenced by binary_addeq_predicate(), binary_inteq_predicate(), binary_multeq_predicate(), Expr_result::do_integral_promotions(), fundamental_conversion_type(), unary_bitnot_predicate(), unary_minus_predicate(), unary_plus_predicate(), and Expr_annotator::visit_assign().

Type Type::get_return_type   const
 

Given a type "function returning T", return T.

Definition at line 179 of file type_rep.cc.

References code, eat_type(), get_kind(), k_Function, and Type().

Referenced by Overload_resolver::add_builtin_binary_ops(), Overload_resolver::add_builtin_incdec(), Class_scope::add_function_decl(), Function_symbol::add_signature(), Simple_declaration_reader::declare_variable(), Expr_annotator::do_funcall(), get_human_readable_type(), and Function_signature::get_return_type().

int Type::get_template_argindex   const
 

Given type "N'th template argument", return N.

Definition at line 233 of file type_rep.cc.

References code, get_kind(), and k_Template.

Type_symbol * Type::get_type_symbol   const
 

Given a user-defined type, return the corresponding Type_symbol.

Definition at line 496 of file type_rep.cc.

References code, Symbol_table::get_instance(), get_kind(), Symbol_table::get_symbol(), k_Userdef, and Symbol_pair::tag.

Referenced by class_or_null(), Implicit_conversion::convert_reference(), Typedef_declaration_reader::declare_variable(), Expr_annotator::do_funcall(), enumerate_conversion_ops(), gen_builtin_conversions(), gen_constructors(), get_composite_mptr_type(), get_composite_pointer_type(), Init_handler::get_default_initializer_for_type(), get_promoted_integer(), Function_signature::has_pointer_type(), Class_symbol::implicit_assignment_operator_style(), Class_symbol::implicit_copy_ctor_is_const(), is_aggregate(), is_class_type(), is_complete(), is_covariant_or_same(), is_enum_type(), is_pod(), Init_handler::make_constructor_call(), Init_handler::process_brace(), process_initializers(), Expr_annotator::process_member_access(), Expr_annotator::process_pm_expr(), Expr_annotator::try_static_cast(), Expr_annotator::visit_array(), Expr_annotator::visit_arrowmember(), Expr_annotator::visit_assign(), Expr_annotator::visit_comma(), Expr_annotator::visit_name(), Expr_annotator::visit_new(), Expr_annotator::visit_postfix(), and Expr_annotator::visit_unary().

Type Type::get_unqualified_type   const [inline]
 

Definition at line 109 of file type_rep.h.

References code, and Type().

Referenced by Overload_resolver::add_builtin_incdec(), Function_type_maker::add_parameter(), Function_symbol::add_signature(), Namespace_scope::add_variable(), Block_scope::add_variable(), Implicit_conversion::convert_reference(), Implicit_conversion::convert_to_rvalue(), Expr_result::convert_to_rvalue(), Function_declaration_reader::declare_variable(), fundamental_conversion_type(), gen_builtin_conversions(), gen_candidates(), gen_constructors(), Function_signature::has_pointer_type(), Expr_annotator::visit_postfix(), and Expr_annotator::visit_throw().

bool Type::is_aggregate   const
 

Definition at line 459 of file type_rep.cc.

References get_kind(), get_type_symbol(), Class_symbol::is_aggregate(), is_valid(), k_Array, and k_Userdef.

bool Type::is_arithmetic_type   const
 

Arithmetic types, 3.9.1p8.

"Integral and floating types are collectively called arithmetic types".

Definition at line 404 of file type_rep.cc.

References is_float(), and is_int().

Referenced by Overload_resolver::add_builtin_incdec(), binary_addeq_predicate(), binary_multeq_predicate(), Expr_result::convert_to_bool(), do_usual_conversions(), index_predicate(), is_pod(), is_scalar_type(), Expr_annotator::process_binary_operator(), Expr_annotator::process_unary_operator(), unary_minus_predicate(), unary_plus_predicate(), Expr_annotator::visit_assign(), Expr_annotator::visit_cond(), and Expr_annotator::visit_postfix().

bool Type::is_class_type   const
 

Definition at line 487 of file type_rep.cc.

References Symbol::get_kind(), get_kind(), get_type_symbol(), Symbol::k_Enum, and k_Userdef.

Referenced by Expr_result::convert_to(), Implicit_conversion::convert_to_rvalue(), Expr_result::convert_to_rvalue(), Expr_annotator::do_funcall(), generate_implicit_conversion(), get_composite_pointer_type(), Init_handler::get_default_initializer_for_type(), Class_symbol::implicit_assignment_operator_style(), Class_symbol::implicit_copy_ctor_is_const(), is_covariant_or_same(), make_cast_expr(), Init_handler::make_constructor_call(), make_derived_to_base_cast(), Init_handler::process_brace(), Init_handler::process_initializer(), process_initializers(), Expr_annotator::process_pm_expr(), Expr_annotator::try_static_cast(), Expr_annotator::visit_arrowmember(), Expr_annotator::visit_assign(), Expr_annotator::visit_cond(), Expr_annotator::visit_delete(), Expr_annotator::visit_dotmember(), Expr_annotator::visit_new(), and Annotator::visit_switch().

bool Type::is_complete   const
 

True iff this type is complete.

3.9p6

Definition at line 378 of file type_rep.cc.

References get_kind(), Symbol::get_status(), get_type_symbol(), is_void(), k_Userdef, and Symbol::st_Defined.

Referenced by check_ptr_arith(), Expr_result::convert_to_rvalue(), make_sizeof_expr(), Expr_annotator::process_unary_operator(), and Expr_annotator::visit_postfix().

bool Type::is_compound_type   const [inline]
 

Compound types, 3.9.2.

"Compound types can be constructed in the following ways: arrays [...], functions [...], pointers [...], references [...], classes [...], unions [...], enumerations [...], pointers to non-static class members [...]". Essentially, anything that's not fundamental.

Definition at line 402 of file type_rep.h.

References get_kind(), and k_Fundamental.

bool Type::is_enum_type   const
 

Definition at line 479 of file type_rep.cc.

References Symbol::get_kind(), get_kind(), get_type_symbol(), Symbol::k_Enum, and k_Userdef.

Referenced by Class_scope::add_variable(), binary_addeq_predicate(), binary_inteq_predicate(), binary_multeq_predicate(), Expr_result::convert_to_bool(), do_usual_conversions(), index_predicate(), is_scalar_type(), try_reinterpret_cast(), Expr_annotator::try_static_cast(), unary_bitnot_predicate(), unary_minus_predicate(), unary_plus_predicate(), Expr_annotator::visit_array(), Expr_annotator::visit_assign(), Annotator::visit_case(), Expr_annotator::visit_cond(), Expr_annotator::visit_infix(), and Annotator::visit_switch().

bool Type::is_float   const [inline]
 

True iff this type is a floating-point type.

Definition at line 390 of file type_rep.h.

References code.

Referenced by binary_multeq_predicate(), fundamental_conversion_type(), is_arithmetic_type(), is_int(), Expr_annotator::process_binary_operator(), and Expr_annotator::process_unary_operator().

bool Type::is_int   const
 

True iff this type is an integral type.

Definition at line 369 of file type_rep.cc.

References code, get_kind(), is_float(), is_void(), and k_Fundamental.

Referenced by Class_scope::add_variable(), binary_addeq_predicate(), binary_inteq_predicate(), binary_multeq_predicate(), fundamental_conversion_type(), gen_builtin_conversions(), is_arithmetic_type(), Expr_result::is_npc(), Expr_annotator::process_binary_operator(), Expr_annotator::process_unary_operator(), Enum_symbol::process_value(), try_reinterpret_cast(), Expr_annotator::try_static_cast(), unary_bitnot_predicate(), Expr_annotator::visit_array(), Expr_annotator::visit_assign(), Annotator::visit_case(), and Annotator::visit_switch().

bool Type::is_more_qualified_than const Type &    other const [inline]
 

Definition at line 114 of file type_rep.h.

References qualifiers.

Referenced by Implicit_conversion::convert_reference(), Implicit_conversion::convert_to_rvalue(), Function_signature::has_pointer_type(), is_covariant_or_same(), is_qualification_convertible_to(), Expr_annotator::process_pm_expr(), try_reinterpret_cast(), and Expr_annotator::try_static_cast().

bool Type::is_object_type   const
 

Object types, 3.9p9.

"An object type is a type that is not a function type, not a reference type, and not a reference type"

Definition at line 392 of file type_rep.cc.

References get_kind(), is_void(), k_Function, and k_Reference.

Referenced by Overload_resolver::add_builtin_incdec(), binary_addeq_predicate(), check_ptr_arith(), unary_delete_or_arrow_predicate(), unary_deref_predicate(), Expr_annotator::visit_delete(), Expr_annotator::visit_new(), and Expr_annotator::visit_pm().

bool Type::is_pod   const
 

True if type is POD (3.9p10).

Definition at line 434 of file type_rep.cc.

References get_basis_type(), get_kind(), get_type_symbol(), is_arithmetic_type(), Class_symbol::is_pod(), is_valid(), k_Array, k_Fundamental, k_Member, k_Pointer, and k_Userdef.

Referenced by Class_scope::add_variable().

bool Type::is_qualification_convertible_to Type    t const
 

True iff this type can be qualification-converted to /t/.

4.4.

Definition at line 563 of file type_rep.cc.

References get_basis_type(), get_class_type(), get_kind(), get_member_type(), is_more_qualified_than(), is_qualified(), is_same_qualified_as(), is_same_unqualified_type(), k_Member, k_Pointer, k_Reference, Kind, and q_Const.

Referenced by gen_builtin_conversions().

bool Type::is_qualified   const [inline]
 

Definition at line 100 of file type_rep.h.

References qualifiers.

Referenced by encode_qualifiers(), and get_human_readable_type().

bool Type::is_qualified Qualifier    q const [inline]
 

Definition at line 99 of file type_rep.h.

References Qualifier, and qualifiers.

Referenced by Overload_resolver::add_builtin_incdec(), Function_symbol::add_signature(), Namespace_scope::add_variable(), Class_scope::add_variable(), gen_candidates(), Symbol_name::get_mangled_function_name(), Class_symbol::implicit_assignment_operator_style(), Class_symbol::implicit_copy_ctor_is_const(), Expr_result::is_modifyable_lvalue(), is_qualification_convertible_to(), parse_qualifier(), Expr_annotator::process_member_access(), and Expr_annotator::visit_name().

bool Type::is_same_qualified_as const Type &    other const [inline]
 

Definition at line 115 of file type_rep.h.

References ignore_qual, and qualifiers.

Referenced by is_covariant_or_same(), and is_qualification_convertible_to().

bool Type::is_same_unqualified_type const Type &    other const [inline]
 

Definition at line 116 of file type_rep.h.

References code.

Referenced by Overload_resolver::add_builtin_incdec(), Function_signature::add_parameter(), binary_multeq_predicate(), Implicit_conversion::convert_reference(), Expr_result::convert_to_qual(), fundamental_conversion_type(), gen_builtin_conversions(), generate_implicit_conversion(), get_composite_mptr_type(), get_composite_pointer_type(), Class_symbol::get_copy_ctor(), get_merged_cv_type(), Function_signature::has_pointer_type(), has_type(), is_character_type(), is_qualification_convertible_to(), Expr_annotator::process_binary_operator(), Expr_annotator::process_unary_operator(), Expr_annotator::try_static_cast(), Expr_annotator::visit_cond(), Expr_annotator::visit_postfix(), and Annotator::visit_return().

bool Type::is_scalar_type   const
 

Scalar types, 3.9p10.

"Arithmetic types, enumeration types, pointer types and pointer to member types, and cv-qualified versions of these types are collectively called scalar types."

Definition at line 415 of file type_rep.cc.

References get_kind(), is_arithmetic_type(), is_enum_type(), k_Fundamental, k_Member, k_Pointer, and k_Userdef.

Referenced by Init_handler::get_default_initializer_for_type(), Init_handler::make_constructor_call(), Init_handler::process_brace(), and Init_handler::process_initializer().

bool Type::is_valid   const [inline]
 

Definition at line 103 of file type_rep.h.

References code.

Referenced by Overload_resolver::add_builtin_binary_ops(), Overload_resolver::add_builtin_unary_ops(), Function_symbol::add_signature(), Expr_result::convert_to(), Expr_result::convert_to_fpointer(), Expr_result::convert_to_pointer(), Expr_result::convert_to_qual(), Expr_result::convert_to_rvalue(), Expr_annotator::do_funcall(), Function_signature::dump(), Expr_result::Expr_result(), Function_signature::Function_signature(), fundamental_conversion_type(), gen_builtin_conversions(), gen_candidates(), Symbol_name::get_mangled_function_name(), Function_signature::get_pointer_type(), Function_signature::has_pointer_type(), is_aggregate(), is_pod(), make_cast_expr(), make_derived_to_base_cast(), make_sizeof_expr(), parse_abstract_declarator(), print_annotated_tree(), Expr_result::set_value(), try_reinterpret_cast(), Expr_annotator::visit_comma(), Expr_annotator::visit_name(), and Expr_annotator::visit_this().

bool Type::is_void   const [inline]
 

True iff this type is void.

Definition at line 382 of file type_rep.h.

References code.

Referenced by Simple_declaration_reader::declare_variable(), fundamental_conversion_type(), gen_builtin_conversions(), generate_implicit_conversion(), get_composite_pointer_type(), is_complete(), is_int(), is_object_type(), Expr_annotator::process_unary_operator(), Expr_annotator::try_static_cast(), Expr_annotator::visit_assign(), Expr_annotator::visit_cond(), Annotator::visit_return(), and Expr_annotator::visit_throw().

Type Type::make_array_type Ptree   dimension const
 

Create array type (array[dimension]-of-this).

Definition at line 101 of file type_rep.cc.

References encode_qualifiers(), and Type().

Referenced by Declaration_reader::parse_declarator_internal(), and Expr_annotator::visit_leaf().

Type Type::make_member_type Type    membertype const
 

Create member type (member-membertype-of-this).

let c = classtype m = membertype then "m c::*" is c.make_member_type(m)

Definition at line 114 of file type_rep.cc.

References encode_qualifiers(), and Type().

Referenced by enumerate_conversion_ops(), gen_builtin_conversions(), get_composite_mptr_type(), get_merged_cv_type(), Function_signature::get_pointer_type(), Declaration_reader::parse_declarator_internal(), and Expr_annotator::visit_unary().

Type Type::make_pointer_type   const [inline]
 

Create pointer type (pointer-to-this).

Definition at line 364 of file type_rep.h.

References encode_qualifiers(), and Type().

Referenced by Function_type_maker::add_parameter(), Expr_result::convert_to_fpointer(), Expr_result::convert_to_pointer(), Implicit_conversion::convert_to_rvalue(), Simple_declaration_reader::declare_variable(), Expr_annotator::do_funcall(), gen_builtin_conversions(), get_composite_pointer_type(), Symbol_name::get_mangled_function_name(), get_merged_cv_type(), index_predicate(), make_this(), Declaration_reader::parse_declarator_internal(), print_annotated_tree(), Expr_annotator::process_unary_operator(), and Expr_annotator::visit_new().

Type Type::make_reference_type   const [inline]
 

Create reference type (reference-to-this).

Definition at line 372 of file type_rep.h.

References encode_qualifiers(), and Type().

Referenced by Overload_resolver::add_builtin_binary_ops(), Overload_resolver::add_builtin_incdec(), Function_symbol::add_signature(), Overload_resolver::add_signature_with_type(), Class_symbol::finish_definition(), generate_ics_for_ternary(), Declaration_reader::parse_declarator_internal(), and unary_deref_predicate().

bool Type::operator!= const Type &    rhs const [inline]
 

Definition at line 112 of file type_rep.h.

References code, ignore_qual, and qualifiers.

bool Type::operator== const Type &    rhs const [inline]
 

Definition at line 111 of file type_rep.h.

References code, ignore_qual, and qualifiers.

void Type::remove_qualifier Qualifier    q [inline]
 

Definition at line 102 of file type_rep.h.

References Qualifier, and qualifiers.

Type Type::sans_array   const
 

Definition at line 146 of file type_rep.cc.

References get_basis_type(), get_kind(), and k_Array.

Referenced by Class_scope::add_variable(), and Expr_annotator::visit_new().

Type Type::sans_reference   const
 

Returns this type with reference removed.

That is, a variable declared as type T denotes an lvalue of type T.sans_reference().

Definition at line 135 of file type_rep.cc.

References get_basis_type(), get_kind(), and k_Reference.

Referenced by binary_addeq_predicate(), binary_inteq_predicate(), binary_multeq_predicate(), Class_symbol::get_copy_ctor(), index_predicate(), and Expr_annotator::visit_name().

Type Type::with_first_arg Type    t const [inline]
 

When this is "function-taking-args-a,b,c", return "function-taking-args-t,a,b,c".

This is needed to make surrogate-functions for overloading.

Definition at line 420 of file type_rep.h.

References code, encode_qualifiers(), get_kind(), and k_Function.

Referenced by Function_symbol::add_signature(), and Expr_annotator::do_funcall().

Type Type::with_qualifier Type::Qualifier    q const [inline]
 

Return this type, with qualifier /q/ added.

Definition at line 410 of file type_rep.h.

References code, Qualifier, qualifiers, and Type().

Referenced by make_this().

Type Type::with_qualifiers const Type &    other const [inline]
 

Return this type, with the qualifiers from /other/ added.

Definition at line 431 of file type_rep.h.

References code, qualifiers, and Type().

Referenced by Implicit_conversion::convert_reference(), Implicit_conversion::convert_to_rvalue(), gen_builtin_conversions(), get_composite_mptr_type(), get_composite_pointer_type(), get_merged_cv_type(), Expr_annotator::process_member_access(), Expr_annotator::process_pm_expr(), and Expr_annotator::visit_cond().


Friends And Related Function Documentation

friend class Function_type_maker [friend]
 

Definition at line 78 of file type_rep.h.


Member Data Documentation

std::string Type::code [private]
 

Definition at line 76 of file type_rep.h.

Referenced by encode_qualifiers(), get_basis_type(), get_class_type(), get_encoded_type(), get_function_arg(), get_function_signature(), get_human_readable_type(), get_kind(), get_member_type(), get_num_function_args(), get_promoted_integer(), get_return_type(), get_template_argindex(), get_type_symbol(), get_unqualified_type(), is_float(), is_int(), is_same_unqualified_type(), is_valid(), is_void(), operator!=(), operator==(), Type(), with_first_arg(), with_qualifier(), and with_qualifiers().

const int Type::ignore_qual = 0 [static]
 

Definition at line 97 of file type_rep.h.

Referenced by is_same_qualified_as(), operator!=(), and operator==().

int Type::qualifiers [private]
 

Definition at line 77 of file type_rep.h.

Referenced by add_qualifier(), copy_qualifiers(), is_more_qualified_than(), is_qualified(), is_same_qualified_as(), operator!=(), operator==(), remove_qualifier(), with_qualifier(), and with_qualifiers().


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