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

type_rep.h File Reference

#include <string>
#include <vector>

Include dependency graph for type_rep.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class  Function_type_maker
 Helper class to construct function types. More...

class  Type
 Throwaway type representation. More...


Typedefs

typedef int Function_specifier_set
typedef std::vector< TypeType_vector

Enumerations

enum  Storage_class_specifier {
  s_None, s_Auto, s_Parameter, s_Register,
  s_Static, s_Extern, s_Mutable, s_Member
}
enum  Function_specifier {
  f_None = 0, f_Inline = 1, f_Virtual = 2, f_Explicit = 4,
  f_Abstract = 8
}

Functions

bool parse_qualifier (Ptree *tree, Type &type)
 Attempt to parse /tree/ as a type-qualifier. More...

Type parse_type (Ptree *tree, Abstract_scope *scope, Ptree *name_for_anon, bool is_type_declaration)
 Parse a type. More...

bool parse_specifier (Ptree *tree, Storage_class_specifier *scs, Function_specifier_set *fs)
 Parse a type-specifier. More...

void parse_specifiers (Ptree *tree, Storage_class_specifier *scs, Function_specifier_set *fs)
 Parse a list of storage class/function specifiers into their representation. More...

const char * get_storage_specifier_name (Storage_class_specifier x)
 Get name of a Storage_class_specifier. More...

std::string get_function_specifier_name (Function_specifier_set s)
 Convert Function_specifier_set to string. More...

Type make_unary_function_type (Type arg, Type ret)
 Handy helper: make an unary function type (function-taking-ARG-and-returning-RET). More...

Type make_binary_function_type (Type arg, Type brg, Type ret)

Variables

Type int_type
Type uint_type
Type short_type
Type ushort_type
Type long_type
Type ulong_type
Type llong_type
Type ullong_type
Type char_type
Type schar_type
Type uchar_type
Type float_type
Type double_type
Type ldouble_type
Type bool_type
Type wchar_type
Type void_type
Type ctor_type
Type ptrdiff_type
Type size_type


Typedef Documentation

typedef int Function_specifier_set
 

Definition at line 66 of file type_rep.h.

Referenced by Template_defn_scope::add_function_decl(), Namespace_scope::add_function_decl(), Class_scope::add_function_decl(), Block_scope::add_function_decl(), Function_symbol::add_signature(), Simple_declaration_reader::declare_variable(), Function_signature::Function_signature(), get_function_specifier_name(), Function_signature::merge_fspec(), parse_specifier(), and parse_specifiers().

typedef std::vector<Type> Type_vector
 

Definition at line 301 of file type_rep.h.

Referenced by Symbol_name::get_mangled_template_name(), Template_class_symbol::get_specialisation(), Template_class_symbol::get_specialisation_from_ptree(), Symbol_name::lookup_for_use(), Template_spec::matches(), parse_template_arg_list(), Template_defn_scope::Template_defn_scope(), and Template_spec::Template_spec().


Enumeration Type Documentation

enum Function_specifier
 

Enumeration values:
f_None 
f_Inline 
f_Virtual 
f_Explicit 
f_Abstract 

Definition at line 59 of file type_rep.h.

Referenced by parse_specifier().

enum Storage_class_specifier
 

Enumeration values:
s_None 
s_Auto 
s_Parameter 
s_Register 
s_Static 
s_Extern 
s_Mutable 
s_Member 

Definition at line 48 of file type_rep.h.

Referenced by Template_defn_scope::add_function_decl(), Namespace_scope::add_function_decl(), Class_scope::add_function_decl(), Block_scope::add_function_decl(), Function_symbol::add_signature(), Template_defn_scope::add_variable(), Namespace_scope::add_variable(), Class_scope::add_variable(), Block_scope::add_variable(), Simple_declaration_reader::declare_variable(), Variable_symbol::define_variable(), Function_signature::Function_signature(), Variable_symbol::get_storage_class(), get_storage_specifier_name(), parse_specifier(), parse_specifiers(), and Variable_symbol::Variable_symbol().


Function Documentation

std::string get_function_specifier_name Function_specifier_set    s
 

Convert Function_specifier_set to string.

Definition at line 1101 of file type_rep.cc.

References f_Abstract, f_Explicit, f_Inline, f_Virtual, and Function_specifier_set.

Referenced by Function_signature::dump().

const char* get_storage_specifier_name Storage_class_specifier    x
 

Get name of a Storage_class_specifier.

Definition at line 1082 of file type_rep.cc.

References Storage_class_specifier.

Referenced by Variable_symbol::dump(), and Function_signature::dump().

Type make_binary_function_type Type    arg,
Type    brg,
Type    ret
 

Definition at line 1133 of file type_rep.cc.

References Function_type_maker::add_parameter(), and Function_type_maker::make_function_type().

Referenced by binary_addeq_predicate(), binary_inteq_predicate(), binary_multeq_predicate(), and index_predicate().

Type make_unary_function_type Type    arg,
Type    ret
 

Handy helper: make an unary function type (function-taking-ARG-and-returning-RET).

Definition at line 1123 of file type_rep.cc.

References Function_type_maker::add_parameter(), and Function_type_maker::make_function_type().

Referenced by Function_symbol::add_signature(), Class_symbol::finish_definition(), init_default_symbols(), unary_bitnot_predicate(), unary_delete_or_arrow_predicate(), unary_deref_predicate(), unary_minus_predicate(), unary_plus_predicate(), and Expr_annotator::visit_unary().

bool parse_qualifier Ptree   tree,
Type   type
 

Attempt to parse /tree/ as a type-qualifier.

Modifies /type/ accordingly. Returns true iff it actually was a type-qualifier.

Definition at line 683 of file type_rep.cc.

References Type::add_qualifier(), compile_error(), CONST, Type::is_qualified(), Type::q_Const, Type::q_Restrict, Type::q_Volatile, RESTRICT, VOLATILE, and Ptree::What().

Referenced by Declaration_reader::parse_declarator_get_name(), Declaration_reader::parse_declarator_internal(), and Type_reader::read_type().

bool parse_specifier Ptree   tree,
Storage_class_specifier   scs,
Function_specifier_set   fs
 

Parse a type-specifier.

Parameters:
tree  one keyword
scs  [in/out] storage class specifier
fs  [in/out] function specifier
Returns:
true iff this was a valid specifier; parameters modified accordingly.

Definition at line 1003 of file type_rep.cc.

References AUTO, compile_error(), Ptree::Eq(), EXPLICIT, EXTERN, f_Explicit, f_Inline, f_None, f_Virtual, Function_specifier, Function_specifier_set, INLINE, MUTABLE, REGISTER, s_Auto, s_Extern, s_Mutable, s_None, s_Register, s_Static, STATIC, Storage_class_specifier, VIRTUAL, and Ptree::What().

Referenced by parse_specifiers().

void parse_specifiers Ptree   tree,
Storage_class_specifier   scs,
Function_specifier_set   fs
 

Parse a list of storage class/function specifiers into their representation.

Parameters:
tree  parse tree
scs  [in/out] storage class specifier so far
fs  [in/out] function specifier set so far

Definition at line 1063 of file type_rep.cc.

References Ptree::Car(), Ptree::Cdr(), compile_error(), Function_specifier_set, Ptree::IsLeaf(), parse_specifier(), Storage_class_specifier, and Ptree::ToString().

Type parse_type Ptree   tree,
Abstract_scope   scope,
Ptree   name_for_anon,
bool    is_type_declaration
 

Parse a type.

Parameters:
tree  a parse tree
scope  active scope
name_for_anon  if the type is an anonymous class, this will be its name
is_type_declaration  if this is a type declaration (i.e. "struct x;"). These have different scoping rules for C combatability.
This function should not assert-fail on types it doesn't understand. OpenC++ often needs us to parse into the blue, so maybe what we get isn't actually a type.

type-specifier ::= simple-type-specifier | class-specifier | enum-specifier | elaborated-type-specifier | cv-qualifier

Definition at line 927 of file type_rep.cc.

References ctor_type(), and Type_reader::get_result().

Referenced by Expr_annotator::get_cast_type(), Symbol_name::init_name(), Declaration_reader::parse_declarator_internal(), parse_template_arg_list(), Expr_annotator::visit_cast(), Expr_annotator::visit_fstylecastexpr(), Annotator::visit_function(), Annotator::visit_name_declaration(), Expr_annotator::visit_new(), Expr_annotator::visit_sizeof(), Annotator::visit_type_declaration(), and Annotator::visit_typedef().


Variable Documentation

Type bool_type
 

Definition at line 293 of file type_rep.h.

Type char_type
 

Definition at line 293 of file type_rep.h.

Type ctor_type
 

Definition at line 293 of file type_rep.h.

Type double_type
 

Definition at line 293 of file type_rep.h.

Type float_type
 

Definition at line 293 of file type_rep.h.

Type int_type
 

Definition at line 293 of file type_rep.h.

Type ldouble_type
 

Definition at line 293 of file type_rep.h.

Type llong_type
 

Definition at line 293 of file type_rep.h.

Type long_type
 

Definition at line 293 of file type_rep.h.

Type ptrdiff_type
 

Definition at line 299 of file type_rep.h.

Type schar_type
 

Definition at line 293 of file type_rep.h.

Type short_type
 

Definition at line 293 of file type_rep.h.

Type size_type
 

Definition at line 299 of file type_rep.h.

Type uchar_type
 

Definition at line 293 of file type_rep.h.

Type uint_type
 

Definition at line 293 of file type_rep.h.

Type ullong_type
 

Definition at line 293 of file type_rep.h.

Type ulong_type
 

Definition at line 293 of file type_rep.h.

Type ushort_type
 

Definition at line 293 of file type_rep.h.

Type void_type
 

Definition at line 293 of file type_rep.h.

Type wchar_type
 

Definition at line 293 of file type_rep.h.


Generated on Mon Feb 10 17:34:54 2003 for VFiasco Semantics Compiler by doxygen1.2.15