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

Expr_annotator Class Reference

#include <expr_annotator.h>

Inheritance diagram for Expr_annotator:

Inheritance graph
[legend]
Collaboration diagram for Expr_annotator:

Collaboration graph
[legend]
List of all members.

Public Methods

 Expr_annotator (Abstract_scope *scope, Source *source)
Expr_result visit_infix (PtreeInfixExpr *p)
 Visit infix operator. More...

Expr_result visit_leaf (Leaf *l)
 Visit a leaf, i.e. literal. More...

Expr_result visit_name (Ptree *p)
 Visit name, i.e. identifier. More...

Expr_result visit_this (LeafThis *p)
 Visit "this" node. More...

Expr_result visit_paren (PtreeParenExpr *e)
 Visit parenthesized expression. More...

Expr_result visit_postfix (PtreePostfixExpr *e)
 Process a postfix expression. More...

Expr_result visit_unary (PtreeUnaryExpr *e)
 Visit unary operator. More...

Expr_result visit_delete (PtreeDeleteExpr *pde)
 "Delete" expression. More...

Expr_result visit_new (PtreeNewExpr *p_)
 Visit "new" operator. More...

Expr_result visit_sizeof (PtreeSizeofExpr *e)
 Visit sizeof expression. More...

Expr_result visit_throw (PtreeThrowExpr *p)
 Visit throw expression. More...

Expr_result visit_dotmember (PtreeDotMemberExpr *e)
 "dot-member" access, "obj.member". More...

Expr_result visit_arrowmember (PtreeArrowMemberExpr *e)
 "arrow-member" access, "ptr->member". More...

Expr_result visit_pm (PtreePmExpr *e)
 Pointer-to-member expression. More...

Expr_result visit_cond (PtreeCondExpr *p)
 Visit ternary expression [if ? then : else]. More...

Expr_result do_fstyle_cast (Type target, Ptree *arglist)
 Make function call. More...

void add_parms_from_arglist (Overload_resolver *resolver, Ptree *p)
Expr_result visit_fstylecastexpr (PtreeFstyleCastExpr *e)
 Function-style cast. More...

Expr_result visit_funcall (PtreeFuncallExpr *e)
 Visit function call expression. More...

Expr_result visit_cast (PtreeCastExpr *p)
 Visit C-style cast expression. More...

Expr_result visit_brace (PtreeBrace *b)
Expr_result visit_assign (PtreeAssignExpr *p)
 Visit assignment or compound assignment expression. More...

Expr_result visit_array (PtreeArrayExpr *p)

Static Public Attributes

const int PTR_DELEGATION_LIMIT = 100

Private Methods

Expr_result visit_comma (PtreeCommaExpr *e)
 Visit comma operator. More...

Expr_result process_binary_operator (Ptree *oper, Expr_result l, Expr_result r)
 Generate annotated result for a built-in binary operator. More...

Expr_result process_unary_operator (Ptree *oper, Expr_result arg)
 Process unary builtin operator. More...

Expr_result process_member_access (Expr_result lhs, Ptree *rhs_tree)
 Process an operation of form "lhs . More...

Expr_result process_pm_expr (Expr_result lhs, const Expr_result &rhs)
 Pointer-to-member expression "lhs .* rhs". More...

Type get_cast_type (Ptree *type_args)
 Given the type tree in a cxx_cast<T>, return the type T. More...

Expr_result get_cast_expr (Ptree *tree)
 Given the expression list in a cxx_cast<T>(x), return the expression x. More...

bool try_static_cast (Type target, bool enforce_const, Expr_result *res)
 Attempt to static_cast /res/ to target, return true iff successful. More...

Expr_result do_dynamic_cast (Ptree *type_args, Ptree *cast_args)
Expr_result do_reinterpret_cast (Ptree *type_args, Ptree *cast_args)
Expr_result do_static_cast (Ptree *type_args, Ptree *cast_args)
Expr_result do_const_cast (Ptree *type_args, Ptree *cast_args)
Expr_result do_ccast (Type t, Ptree *arg)
 Do C-style cast. More...

Expr_result do_funcall (Expr_result lhs, Ptree *arglist)
 Make function call. More...


Private Attributes

Abstract_scopecurrent_scope

Constructor & Destructor Documentation

Expr_annotator::Expr_annotator Abstract_scope   scope,
Source   source
 

Definition at line 366 of file expr_annotator.cc.


Member Function Documentation

void Expr_annotator::add_parms_from_arglist Overload_resolver   resolver,
Ptree   p
 

Definition at line 2229 of file expr_annotator.cc.

References Overload_resolver::add_arg(), Ptree::Car(), Ptree::Cdr(), expect_ptree(), and Ptree_visitor< Expr_result >::visit().

Referenced by do_funcall(), and visit_new().

Expr_result Expr_annotator::do_ccast Type    t,
Ptree   arg
[private]
 

Do C-style cast.

Parameters:
t  target type
arg  parameter expression

Definition at line 2197 of file expr_annotator.cc.

References compile_error(), try_reinterpret_cast(), try_static_cast(), and Ptree_visitor< Expr_result >::visit().

Referenced by do_fstyle_cast(), and visit_cast().

Expr_result Expr_annotator::do_const_cast Ptree   type_args,
Ptree   cast_args
[private]
 

Definition at line 2184 of file expr_annotator.cc.

References compile_error(), get_cast_expr(), and get_cast_type().

Referenced by visit_funcall().

Expr_result Expr_annotator::do_dynamic_cast Ptree   type_args,
Ptree   cast_args
[private]
 

Definition at line 2150 of file expr_annotator.cc.

References compile_error(), get_cast_expr(), and get_cast_type().

Referenced by visit_funcall().

Expr_result Expr_annotator::do_fstyle_cast Type    target,
Ptree   arglist
 

Make function call.

Parameters:
target  target type
arglist  list of arguments [a , b , c]

Definition at line 2212 of file expr_annotator.cc.

References Ptree::Car(), current_scope, do_ccast(), Ptree::Length(), and Expr_result::set_value().

Referenced by visit_fstylecastexpr(), and visit_funcall().

Expr_result Expr_annotator::do_funcall Expr_result    lhs,
Ptree   arglist
[private]
 

Make function call.

Parameters:
lhs  left-hand side of the function call, i.e. the function to call
arglist  list of arguments [a , b , c]

Definition at line 2252 of file expr_annotator.cc.

References Annotated_funcall_maker::add_arg(), Overload_resolver::add_arg(), Overload_resolver::add_function(), add_parms_from_arglist(), Overload_resolver::add_signature(), Symbol_name::CALL_OPERATOR_NAME, compile_error(), compile_warning(), Conversion_op_map, current_scope, enumerate_conversion_ops(), fill_in_overload_annotation(), Overload_candidate::fsig, Overload_resolver::get_arg(), Overload_resolver::get_arg_count(), Type::get_basis_type(), Overload_resolver::get_best(), Function_signature::get_call_type(), Expr_result::get_function(), Type::get_human_readable_type(), Type::get_kind(), Symbol::get_name(), Expr_result::get_object(), Type::get_return_type(), Function_signature::get_return_type(), Class_symbol::get_scope(), Function_signature::get_storage_specifier(), Abstract_scope::get_this_type(), Expr_result::get_tree(), Annotation::get_type(), Expr_result::get_type(), Type::get_type_symbol(), Expr_result::is_bound_member(), Expr_result::is_bound_pmf(), Function_signature::is_builtin(), Type::is_class_type(), Expr_result::is_function(), Overload_resolver::is_object(), Type::is_valid(), Expr_result::is_value(), Type::k_Function, Expr_result::k_LValue, Type::k_Pointer, Expr_result::k_RValue, Class_scope::lookup_here(), Function_signature::make_builtin(), make_comma_expr(), Annotated_funcall_maker::make_funcall(), make_name(), Type::make_pointer_type(), make_this_star(), s_Member, s_Static, Overload_resolver::set_object(), Expr_result::set_value(), Symbol_pair::untag, and Type::with_first_arg().

Referenced by visit_cast(), and visit_funcall().

Expr_result Expr_annotator::do_reinterpret_cast Ptree   type_args,
Ptree   cast_args
[private]
 

Definition at line 2160 of file expr_annotator.cc.

References compile_error(), get_cast_expr(), get_cast_type(), and try_reinterpret_cast().

Referenced by visit_funcall().

Expr_result Expr_annotator::do_static_cast Ptree   type_args,
Ptree   cast_args
[private]
 

Definition at line 2172 of file expr_annotator.cc.

References compile_error(), get_cast_expr(), get_cast_type(), and try_static_cast().

Referenced by visit_funcall().

Expr_result Expr_annotator::get_cast_expr Ptree   tree [private]
 

Given the expression list in a cxx_cast<T>(x), return the expression x.

Definition at line 2007 of file expr_annotator.cc.

References compile_error(), Ptree::First(), Ptree::IsLeaf(), Ptree::Length(), and Ptree_visitor< Expr_result >::visit().

Referenced by do_const_cast(), do_dynamic_cast(), do_reinterpret_cast(), and do_static_cast().

Type Expr_annotator::get_cast_type Ptree   type_args [private]
 

Given the type tree in a cxx_cast<T>, return the type T.

Definition at line 1986 of file expr_annotator.cc.

References compile_error(), current_scope, expect_ptree(), Ptree::First(), Ptree::IsLeaf(), Ptree::Length(), parse_abstract_declarator(), parse_type(), Ptree::Second(), and Ptree::Third().

Referenced by do_const_cast(), do_dynamic_cast(), do_reinterpret_cast(), and do_static_cast().

Expr_result Expr_annotator::process_binary_operator Ptree   oper,
Expr_result    l,
Expr_result    r
[private]
 

Generate annotated result for a built-in binary operator.

Definition at line 470 of file expr_annotator.cc.

References bogus_ptree_error(), check_ptr_arith(), compile_error(), compile_warning(), Expr_result::convert_to_bool(), Expr_result::do_integral_promotions(), do_mptr_arith_conversions(), do_pointer_arith_conversions(), Expr_result::do_std_conversions(), do_usual_conversions(), Ptree::Eq(), Type::get_kind(), Expr_result::get_tree(), Expr_result::get_type(), Type::is_arithmetic_type(), Type::is_float(), Type::is_int(), Expr_result::is_npc(), Type::is_same_unqualified_type(), Type::k_Member, Type::k_Pointer, Expr_result::k_RValue, and make_infix_expr().

Referenced by visit_infix().

Expr_result Expr_annotator::process_member_access Expr_result    lhs,
Ptree   rhs_tree
[private]
 

Process an operation of form "lhs .

rhs_tree". The rhs_tree is a name.

Definition at line 1598 of file expr_annotator.cc.

References Annotation::add_flag(), Type::add_qualifier(), Annotation::af_DirectCall, compile_error(), compile_warning(), Variable_symbol::get_class(), Class_scope::get_class_symbol(), Expr_result::get_kind(), Symbol::get_name(), Symbol_name::get_name(), Symbol_name::get_scope(), Class_symbol::get_scope(), Variable_symbol::get_storage_class(), Expr_result::get_tree(), Variable_symbol::get_type(), Type_symbol::get_type(), Expr_result::get_type(), Type::get_type_symbol(), Variable_symbol::is_member_variable(), Type::is_qualified(), Symbol_name::is_qualified(), Class_symbol::is_unique_base_class_of(), Ptree::List(), Symbol_name::lookup_for_use(), make_comma_expr(), make_derived_to_base_cast(), make_name(), make_static_leaf(), Type::q_Const, s_Mutable, Symbol_pair::untag, and Type::with_qualifiers().

Referenced by visit_arrowmember(), and visit_dotmember().

Expr_result Expr_annotator::process_pm_expr Expr_result    lhs,
const Expr_result   rhs
[private]
 

Pointer-to-member expression "lhs .* rhs".

Definition at line 1755 of file expr_annotator.cc.

References compile_error(), Type::get_class_type(), Expr_result::get_kind(), Type::get_kind(), Type::get_member_type(), Symbol::get_name(), Expr_result::get_tree(), Expr_result::get_type(), Type::get_type_symbol(), Type::is_class_type(), Type::is_more_qualified_than(), Class_symbol::is_unique_base_class_of(), Type::k_Function, Type::k_Member, Ptree::List(), make_derived_to_base_cast(), make_static_leaf(), and Type::with_qualifiers().

Referenced by visit_pm().

Expr_result Expr_annotator::process_unary_operator Ptree   oper,
Expr_result    arg
[private]
 

Process unary builtin operator.

Parameters:
oper  the operator. Must be a leaf containing the operator.
arg  visited parameter

Definition at line 1020 of file expr_annotator.cc.

References bogus_ptree_error(), compile_error(), Expr_result::convert_to_bool(), Expr_result::do_integral_promotions(), Expr_result::do_std_conversions(), Ptree::Eq(), Type::get_basis_type(), Type::get_kind(), Expr_result::get_tree(), Expr_result::get_type(), Type::is_arithmetic_type(), Type::is_complete(), Type::is_float(), Expr_result::is_function(), Type::is_int(), Expr_result::is_lvalue(), Expr_result::is_modifyable_lvalue(), Type::is_same_unqualified_type(), Expr_result::is_value(), Type::is_void(), Type::k_Function, Expr_result::k_LValue, Type::k_Pointer, Expr_result::k_RValue, Type::make_pointer_type(), and make_prefix_expr().

Referenced by visit_unary().

bool Expr_annotator::try_static_cast Type    target,
bool    enforce_const,
Expr_result   res
[private]
 

Attempt to static_cast /res/ to target, return true iff successful.

Definition at line 2018 of file expr_annotator.cc.

References Expr_result::convert_to(), generate_implicit_conversion(), Type::get_basis_type(), Type::get_class_type(), Type::get_kind(), Type::get_member_type(), Expr_result::get_type(), Type::get_type_symbol(), Type::is_class_type(), Type::is_enum_type(), Type::is_int(), Type::is_more_qualified_than(), Type::is_same_unqualified_type(), Expr_result::is_value(), Type::is_void(), Type::k_Function, Type::k_Member, Type::k_Pointer, and Implicit_conversion::make_tree().

Referenced by do_ccast(), and do_static_cast().

Expr_result Expr_annotator::visit_array PtreeArrayExpr   p [virtual]
 

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 2854 of file expr_annotator.cc.

References Annotated_funcall_maker::add_arg(), Overload_resolver::add_arg(), Overload_resolver::add_builtin_binary_ops(), Overload_resolver::add_function(), check_ptr_arith(), compile_error(), compile_warning(), Expr_result::convert_to(), current_scope, Expr_result::do_std_conversions(), expect_ptree(), Ptree::First(), Overload_candidate::fsig, Overload_resolver::get_arg(), Type::get_basis_type(), Overload_resolver::get_best(), Type::get_human_readable_type(), Type::get_kind(), Function_signature::get_return_type(), Class_symbol::get_scope(), Expr_result::get_tree(), Expr_result::get_type(), Type::get_type_symbol(), Symbol_name::INDEX_OPERATOR_NAME, Function_signature::is_builtin(), Type::is_enum_type(), Type::is_int(), Expr_result::k_LValue, Type::k_Pointer, Type::k_Userdef, Ptree::List(), Class_scope::lookup_here(), Abstract_scope::lookup_unqualified(), Annotated_funcall_maker::make_funcall(), make_name(), Ptree::Nth(), Ptree::Second(), Expr_result::set_value(), Ptree::Third(), Symbol_pair::untag, and Ptree_visitor< Expr_result >::visit().

Expr_result Expr_annotator::visit_arrowmember PtreeArrowMemberExpr   e [virtual]
 

"arrow-member" access, "ptr->member".

We must resolve the operator-> if the lhs is not a pointer.

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 1687 of file expr_annotator.cc.

References Overload_resolver::add_arg(), Overload_resolver::add_builtin_unary_ops(), Overload_resolver::add_function(), compile_error(), compile_warning(), expect_ptree(), Ptree::First(), Overload_candidate::fsig, Overload_resolver::get_arg(), Type::get_basis_type(), Overload_resolver::get_best(), Type::get_kind(), Function_signature::get_return_type(), Class_symbol::get_scope(), Expr_result::get_tree(), Expr_result::get_type(), Type::get_type_symbol(), Type::is_class_type(), Expr_result::k_LValue, Type::k_Pointer, Class_scope::lookup_here(), make_name(), make_prefix_expr(), make_static_leaf(), make_unary_funcall(), process_member_access(), PTR_DELEGATION_LIMIT, Symbol_name::PTR_OPERATOR_NAME, Ptree::Second(), Expr_result::set_value(), Ptree::Third(), Symbol_pair::untag, and Ptree_visitor< Expr_result >::visit().

Expr_result Expr_annotator::visit_assign PtreeAssignExpr   p [virtual]
 

Visit assignment or compound assignment expression.

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 2638 of file expr_annotator.cc.

References Annotated_funcall_maker::add_arg(), Overload_resolver::add_arg(), Overload_resolver::add_builtin_binary_ops(), Overload_resolver::add_function(), Symbol_name::ASSIGNMENT_OPERATOR_NAME, bogus_ptree_error(), check_ptr_arith(), compile_error(), Expr_result::convert_to(), current_scope, Ptree::Eq(), Ptree::First(), Overload_candidate::fsig, generate_implicit_conversion(), Overload_resolver::get_arg(), Overload_resolver::get_best(), Type::get_human_readable_type(), Type::get_kind(), Symbol::get_name(), Type::get_promoted_integer(), Function_signature::get_return_type(), Class_symbol::get_scope(), Expr_result::get_tree(), Expr_result::get_type(), Type::get_type_symbol(), Type::is_arithmetic_type(), Function_signature::is_builtin(), Type::is_class_type(), Type::is_enum_type(), Type::is_int(), Expr_result::is_modifyable_lvalue(), Expr_result::is_value(), Type::is_void(), Expr_result::k_LValue, Type::k_Pointer, Type::k_Userdef, Ptree::List(), Class_symbol::lookup_helper(), Class_scope::lookup_here(), Abstract_scope::lookup_unqualified(), Annotated_funcall_maker::make_funcall(), make_name(), Implicit_conversion::make_tree(), Ptree::Second(), Overload_resolver::set_object(), Expr_result::set_value(), Ptree::Third(), Ptree::ToString(), Symbol_pair::untag, and Ptree_visitor< Expr_result >::visit().

Expr_result Expr_annotator::visit_brace PtreeBrace   b [virtual]
 

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 2559 of file expr_annotator.cc.

References compile_error().

Expr_result Expr_annotator::visit_cast PtreeCastExpr   p [virtual]
 

Visit C-style cast expression.

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 2517 of file expr_annotator.cc.

References compile_error(), compile_warning(), convert_comma_expr_to_list(), convert_decl_to_expr(), current_scope, do_ccast(), do_funcall(), Ptree::Eq(), expect_ptree(), Ptree::First(), Ptree::Nth(), parse_abstract_declarator(), parse_type(), Ptree::Second(), Ptree::Third(), Ptree::ToString(), Ptree_visitor< Expr_result >::visit(), and visit_infix().

Expr_result Expr_annotator::visit_comma PtreeCommaExpr   e [private, virtual]
 

Visit comma operator.

[lhs , rhs] Comma operators generate a different node than other infix operators, probably due to their different semantics.

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 421 of file expr_annotator.cc.

References Annotated_funcall_maker::add_arg(), Overload_resolver::add_arg(), Overload_resolver::add_function(), Symbol_name::COMMA_OPERATOR_NAME, compile_error(), current_scope, expect_ptree(), Ptree::First(), Overload_candidate::fsig, Overload_resolver::get_arg(), Overload_resolver::get_best(), Type::get_kind(), Function_signature::get_return_type(), Class_symbol::get_scope(), Expr_result::get_tree(), Expr_result::get_type(), Type::get_type_symbol(), Expr_result::is_function(), Type::is_valid(), Expr_result::is_value(), Type::k_Userdef, Class_scope::lookup_here(), Abstract_scope::lookup_unqualified(), make_comma_expr(), Annotated_funcall_maker::make_funcall(), make_name(), Ptree::Second(), Expr_result::set_tree(), Expr_result::set_value(), Ptree::Third(), Symbol_pair::untag, and Ptree_visitor< Expr_result >::visit().

Expr_result Expr_annotator::visit_cond PtreeCondExpr   p [virtual]
 

Visit ternary expression [if ? then : else].

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 1865 of file expr_annotator.cc.

References compile_error(), do_mptr_arith_conversions(), do_pointer_arith_conversions(), Expr_result::do_std_conversions(), do_usual_conversions(), expect_ptree(), Ptree::First(), generate_ics_for_ternary(), generate_implicit_conversion(), Type::get_kind(), Expr_result::get_tree(), Expr_result::get_type(), Type::is_arithmetic_type(), Type::is_class_type(), Type::is_enum_type(), Expr_result::is_lvalue(), Expr_result::is_npc(), Type::is_same_unqualified_type(), Type::is_void(), Expr_result::k_LValue, Type::k_Member, Type::k_Pointer, Expr_result::k_RValue, make_cond_expr(), Implicit_conversion::make_tree(), Ptree::Nth(), Ptree::Second(), Ptree::Third(), Ptree_visitor< Expr_result >::visit(), and Type::with_qualifiers().

Expr_result Expr_annotator::visit_delete PtreeDeleteExpr   pde [virtual]
 

"Delete" expression.

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 1270 of file expr_annotator.cc.

References Overload_resolver::add_arg(), Overload_resolver::add_builtin_unary_ops(), Ptree::Cdr(), compile_error(), Ptree::Eq(), expect_ptree(), Ptree::First(), Overload_resolver::get_arg(), Type::get_basis_type(), Overload_resolver::get_best(), Type::get_kind(), Expr_result::get_tree(), Expr_result::get_type(), Type::is_class_type(), Type::is_object_type(), Type::k_Pointer, Expr_result::k_RValue, Ptree::List(), Ptree::Nth(), Ptree::Second(), Ptree::Third(), and Ptree_visitor< Expr_result >::visit().

Expr_result Expr_annotator::visit_dotmember PtreeDotMemberExpr   e [virtual]
 

"dot-member" access, "obj.member".

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 1671 of file expr_annotator.cc.

References compile_error(), expect_ptree(), Ptree::First(), Expr_result::get_type(), Type::is_class_type(), process_member_access(), Ptree::Second(), Ptree::Third(), and Ptree_visitor< Expr_result >::visit().

Expr_result Expr_annotator::visit_fstylecastexpr PtreeFstyleCastExpr   e [virtual]
 

Function-style cast.

This one's identical to calling a constructor.

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 2447 of file expr_annotator.cc.

References current_scope, do_fstyle_cast(), expect_ptree(), Ptree::First(), Ptree::Nth(), parse_type(), Ptree::Second(), and Ptree::Third().

Expr_result Expr_annotator::visit_funcall PtreeFuncallExpr   e [virtual]
 

Visit function call expression.

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 2460 of file expr_annotator.cc.

References compile_error(), current_scope, do_const_cast(), do_dynamic_cast(), do_fstyle_cast(), do_funcall(), do_reinterpret_cast(), do_static_cast(), Ptree::Eq(), expect_ptree(), Ptree::First(), Type_symbol::get_type(), Typedef_symbol::get_type(), Ptree::IsLeaf(), Symbol_name::lookup_for_use(), Ptree::Nth(), ptree_is_name(), Ptree::Second(), Ptree::Third(), Ptree::ToString(), Symbol_pair::untag, and Ptree_visitor< Expr_result >::visit().

Expr_result Expr_annotator::visit_infix PtreeInfixExpr   p [virtual]
 

Visit infix operator.

[ lhs oper rhs ]

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 665 of file expr_annotator.cc.

References compile_error(), Ptree::First(), Type::get_kind(), Expr_result::get_type(), Type::is_enum_type(), Type::k_Userdef, process_binary_operator(), Ptree::Second(), Ptree::Third(), and Ptree_visitor< Expr_result >::visit().

Referenced by visit_cast().

Expr_result Expr_annotator::visit_leaf Leaf   l [virtual]
 

Visit a leaf, i.e. literal.

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 685 of file expr_annotator.cc.

References bogus_ptree_error(), Expr_result::k_RValue, Type::make_array_type(), and Ptree::ToString().

Expr_result Expr_annotator::visit_name Ptree   p [virtual]
 

Visit name, i.e. identifier.

Parameter may be LeafName (unqual) or PtreeName (qualified)

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 739 of file expr_annotator.cc.

References Type::add_qualifier(), compile_error(), current_scope, Ptree::Eq(), Variable_symbol::get_class(), Symbol::get_kind(), Function_symbol::get_nonoverloaded_signature(), Variable_symbol::get_storage_class(), Function_signature::get_storage_specifier(), Abstract_scope::get_this_type(), Variable_symbol::get_type(), Type::get_type_symbol(), Variable_symbol::has_address(), Variable_symbol::is_member_variable(), Function_symbol::is_overloaded(), Type::is_qualified(), Class_symbol::is_unique_base_class_of(), Type::is_valid(), Ptree::IsLeaf(), Symbol::k_Function, Expr_result::k_LValue, Expr_result::k_RValue, Symbol::k_Variable, Expr_result::Kind, Ptree::List(), make_name(), make_static_leaf(), make_this_star(), Type::q_Const, s_Member, s_Mutable, Type::sans_reference(), Ptree::ToString(), and Symbol_pair::untag.

Referenced by visit_sizeof().

Expr_result Expr_annotator::visit_new PtreeNewExpr   p_ [virtual]
 

Visit "new" operator.

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 1365 of file expr_annotator.cc.

References Overload_resolver::add_arg(), Overload_resolver::add_function(), add_parms_from_arglist(), Symbol_name::ANEW_OPERATOR_NAME, Ptree::Car(), Ptree::Cdr(), compile_error(), current_scope, Ptree::Eq(), expect_ptree(), Ptree::First(), Overload_candidate::fsig, Overload_resolver::get_arg(), Overload_resolver::get_arg_count(), Type::get_basis_type(), Overload_resolver::get_best(), Type::get_encoded_type(), Abstract_scope::get_global_scope(), Type::get_human_readable_type(), Type::get_kind(), Expr_result::get_tree(), Type::get_type_symbol(), Type::is_class_type(), Type::is_object_type(), Type::k_Array, Expr_result::k_RValue, Ptree::Length(), Ptree::List(), Abstract_scope::lookup_here(), make_name(), Type::make_pointer_type(), make_sizeof_expr(), make_static_leaf(), Symbol_name::NEW_OPERATOR_NAME, Ptree::Nth(), parse_abstract_declarator(), parse_type(), Type::sans_array(), Ptree::Second(), Ptree::Snoc(), Ptree::Third(), and Symbol_pair::untag.

Expr_result Expr_annotator::visit_paren PtreeParenExpr   e [virtual]
 

Visit parenthesized expression.

These have no semantics, and don't appear in output.

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 825 of file expr_annotator.cc.

References expect_ptree(), Ptree::First(), Ptree::Second(), Ptree::Third(), and Ptree_visitor< Expr_result >::visit().

Expr_result Expr_annotator::visit_pm PtreePmExpr   e [virtual]
 

Pointer-to-member expression.

Syntax is [lhs .* rhs] or [lhs ->* rhs]

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 1801 of file expr_annotator.cc.

References bogus_ptree_error(), compile_error(), Ptree::Eq(), Ptree::First(), Type::get_basis_type(), Type::get_kind(), Expr_result::get_tree(), Expr_result::get_type(), Type::is_object_type(), Expr_result::k_LValue, Type::k_Pointer, make_prefix_expr(), make_static_leaf(), process_pm_expr(), Ptree::Second(), Ptree::Third(), and Ptree_visitor< Expr_result >::visit().

Expr_result Expr_annotator::visit_postfix PtreePostfixExpr   e [virtual]
 

Process a postfix expression.

Input is | PtreePostfixExpr | expression | ++ or --

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 841 of file expr_annotator.cc.

References Annotated_funcall_maker::add_arg(), Overload_resolver::add_arg(), Overload_resolver::add_builtin_incdec(), Overload_resolver::add_function(), bogus_ptree_error(), compile_error(), current_scope, Ptree::Eq(), Ptree::First(), Overload_candidate::fsig, Overload_resolver::get_arg(), Type::get_basis_type(), Overload_resolver::get_best(), Type::get_kind(), Symbol_name::get_operator_name(), Function_signature::get_return_type(), Class_symbol::get_scope(), Expr_result::get_tree(), Expr_result::get_type(), Type::get_type_symbol(), Type::get_unqualified_type(), Type::is_arithmetic_type(), Function_signature::is_builtin(), Type::is_complete(), Expr_result::is_modifyable_lvalue(), Type::is_same_unqualified_type(), Type::k_Pointer, Expr_result::k_RValue, Type::k_Userdef, Ptree::List(), Class_scope::lookup_here(), Abstract_scope::lookup_unqualified(), Annotated_funcall_maker::make_funcall(), make_name(), Ptree::Second(), Expr_result::set_value(), Ptree::ToString(), Symbol_pair::untag, and Ptree_visitor< Expr_result >::visit().

Expr_result Expr_annotator::visit_sizeof PtreeSizeofExpr   e [virtual]
 

Visit sizeof expression.

Those can take both expressions and types.

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 1500 of file expr_annotator.cc.

References bogus_ptree_error(), compile_error(), current_scope, expect_ptree(), Ptree::First(), Expr_result::get_type(), Type_symbol::get_type(), Ptree::IsLeaf(), Ptree::Length(), make_sizeof_expr(), Ptree::Nth(), parse_abstract_declarator(), parse_type(), Ptree::Second(), Ptree::Third(), Ptree_visitor< Expr_result >::visit(), and visit_name().

Expr_result Expr_annotator::visit_this LeafThis   p [virtual]
 

Visit "this" node.

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 808 of file expr_annotator.cc.

References compile_error(), current_scope, expect_ptree(), Abstract_scope::get_this_type(), Type::is_valid(), Expr_result::k_RValue, and make_this().

Expr_result Expr_annotator::visit_throw PtreeThrowExpr   p [virtual]
 

Visit throw expression.

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 1567 of file expr_annotator.cc.

References compile_error(), Expr_result::convert_to_fpointer(), Expr_result::convert_to_pointer(), Expr_result::convert_to_qual(), expect_ptree(), Ptree::First(), Expr_result::get_tree(), Expr_result::get_type(), Type::get_unqualified_type(), Type::is_void(), Expr_result::k_RValue, Ptree::List(), Ptree::Second(), and Ptree_visitor< Expr_result >::visit().

Expr_result Expr_annotator::visit_unary PtreeUnaryExpr   e [virtual]
 

Visit unary operator.

Input is [op arg].

Reimplemented from Ptree_visitor< Expr_result >.

Definition at line 1116 of file expr_annotator.cc.

References Overload_resolver::add_arg(), Overload_resolver::add_builtin_incdec(), Overload_resolver::add_builtin_unary_ops(), Overload_resolver::add_function(), Overload_resolver::add_signature(), compile_error(), current_scope, Ptree::Eq(), Ptree::First(), Overload_candidate::fsig, Overload_resolver::get_arg(), Overload_resolver::get_best(), Variable_symbol::get_class(), Type::get_kind(), Function_symbol::get_nonoverloaded_signature(), Symbol_name::get_operator_name(), Function_signature::get_pointer_type(), Function_signature::get_return_type(), Class_symbol::get_scope(), Expr_result::get_tree(), Expr_result::get_type(), Variable_symbol::get_type(), Type_symbol::get_type(), Type::get_type_symbol(), Function_signature::is_builtin(), Variable_symbol::is_member_variable(), Function_symbol::is_overloaded(), Symbol_name::is_qualified(), Ptree::IsLeaf(), Expr_result::k_RValue, Type::k_Userdef, Symbol_name::lookup_for_use(), Class_scope::lookup_here(), Abstract_scope::lookup_unqualified(), Function_signature::make_builtin(), Type::make_member_type(), make_name(), make_prefix_expr(), make_unary_funcall(), make_unary_function_type(), process_unary_operator(), ptree_is_name(), Ptree::Second(), Expr_result::set_value(), Ptree::ToString(), Symbol_pair::untag, and Ptree_visitor< Expr_result >::visit().


Member Data Documentation

Abstract_scope* Expr_annotator::current_scope [private]
 

Definition at line 30 of file expr_annotator.h.

Referenced by do_fstyle_cast(), do_funcall(), get_cast_type(), visit_array(), visit_assign(), visit_cast(), visit_comma(), visit_fstylecastexpr(), visit_funcall(), visit_name(), visit_new(), visit_postfix(), visit_sizeof(), visit_this(), and visit_unary().

const int Expr_annotator::PTR_DELEGATION_LIMIT = 100 [static]
 

Definition at line 32 of file expr_annotator.h.

Referenced by visit_arrowmember().


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