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

Annotator Class Reference

#include <annotator.h>

Inheritance diagram for Annotator:

Inheritance graph
[legend]
Collaboration diagram for Annotator:

Collaboration graph
[legend]
List of all members.

Public Methods

 Annotator (Source *s, Abstract_scope *scope)
 Annotator (Source *s, Block_scope *scope)
Annotator_RT visit_name_declaration (Ptree *storagespec, Ptree *typespec, Ptree *decllist)
 Name declaration. More...

Annotator_RT visit_function (Ptree *storagespec, Ptree *typespec, PtreeDeclarator *decl, PtreeBlock *block)
Annotator_RT visit_templatedecl (PtreeTemplateDecl *p)
Annotator_RT visit_linkagespec (PtreeLinkageSpec *p)
Annotator_RT visit_brace (PtreeBrace *p)
Annotator_RT visit_typedef (PtreeTypedef *p)
Annotator_RT visit_type_declaration (Ptree *storagespec, Ptree *typespec)
 Type declaration, i.e. lone "class Foo" in program. More...

Annotator_RT visit_accessspec (PtreeAccessSpec *p)
 Access specifier (public/private/protected). More...

Annotator_RT visit_namespacespec (PtreeNamespaceSpec *p)
Annotator_RT visit_nonleaf (NonLeaf *p)
Annotator_RT visit_using (PtreeUsing *p)
void visit_stmt_or_block (Ptree *p)
Annotator_RT visit_block (PtreeBlock *p)
 Visit a block. More...

Annotator_RT visit_do (PtreeDoStatement *p)
Annotator_RT visit_while (PtreeWhileStatement *p)
Annotator_RT visit_if (PtreeIfStatement *p)
Annotator_RT visit_exprstatement (PtreeExprStatement *p)
 Expression or null statement. More...

Annotator_RT visit_for (PtreeForStatement *p)
Annotator_RT visit_return (PtreeReturnStatement *p)
Annotator_RT visit_switch (PtreeSwitchStatement *p)
Annotator_RT visit_label (PtreeLabelStatement *lbl)
Annotator_RT visit_default (PtreeDefaultStatement *lbl)
Annotator_RT visit_case (PtreeCaseStatement *c)
Annotator_RT visit_goto (PtreeGotoStatement *g)
Annotator_RT visit_continue (PtreeContinueStatement *c)
Annotator_RT visit_break (PtreeBreakStatement *b)
void process_pending ()
 Process pending stuff. More...

void add_output (Ptree *node)
 Add a node to the output list. More...

void add_output_list (Ptree *nodes)
 Add a list of nodes to the output list. More...

Ptreeget_output () const
 Get output list accumulated so far. More...

PtreeBlockget_output_as_block () const
 Get output list accumulated so far, wrapped into a PtreeBlock. More...

bool is_code () const
 True iff we are inside code, false at namespace/class scope. More...


Private Attributes

Abstract_scopecurrent_scope
Block_scopecurrent_block
Ptreeoutput

Constructor & Destructor Documentation

Annotator::Annotator Source   s,
Abstract_scope   scope
 

Definition at line 18 of file annotator.cc.

References Annotator_RT.

Annotator::Annotator Source   s,
Block_scope   scope
 

Definition at line 29 of file annotator.cc.

References Annotator_RT.


Member Function Documentation

void Annotator::add_output Ptree   node
 

Add a node to the output list.

Definition at line 847 of file annotator.cc.

References output, and Ptree::Snoc().

Referenced by Simple_declaration_reader::declare_variable(), visit_block(), visit_break(), visit_case(), visit_continue(), visit_default(), visit_do(), visit_exprstatement(), visit_for(), visit_goto(), visit_if(), visit_label(), visit_return(), visit_switch(), and visit_while().

void Annotator::add_output_list Ptree   nodes
 

Add a list of nodes to the output list.

Definition at line 857 of file annotator.cc.

References Ptree::Append(), Ptree::IsLeaf(), and output.

Referenced by visit_namespacespec().

Ptree * Annotator::get_output   const [inline]
 

Get output list accumulated so far.

Definition at line 142 of file annotator.h.

References output.

Referenced by get_output_as_block(), Template_class_symbol::get_specialisation(), main(), process_function_body(), and visit_namespacespec().

PtreeBlock * Annotator::get_output_as_block   const
 

Get output list accumulated so far, wrapped into a PtreeBlock.

Definition at line 869 of file annotator.cc.

References get_output(), Ptree::List(), and make_static_leaf().

Referenced by visit_block(), visit_do(), visit_for(), visit_if(), visit_switch(), and visit_while().

bool Annotator::is_code   const [inline]
 

True iff we are inside code, false at namespace/class scope.

Definition at line 150 of file annotator.h.

References current_block.

Referenced by visit_block(), visit_brace(), visit_do(), visit_exprstatement(), visit_if(), visit_return(), and visit_while().

void Annotator::process_pending  
 

Process pending stuff.

Call this after every nontrivial operation. In particular, this processes the deferred member function definitions.

Definition at line 838 of file annotator.cc.

References current_scope, and Abstract_scope::process_pending().

Referenced by visit_function(), visit_name_declaration(), visit_templatedecl(), visit_type_declaration(), and visit_typedef().

Annotator_RT Annotator::visit_accessspec PtreeAccessSpec   p [virtual]
 

Access specifier (public/private/protected).

We happily ignore these. Access checks are done by the compiler, so we only get programs where all access checks work.

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 330 of file annotator.cc.

Annotator_RT Annotator::visit_block PtreeBlock   p [virtual]
 

Visit a block.

[ list-of-things ]

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 419 of file annotator.cc.

References add_output(), Ptree::Car(), Ptree::Cdr(), current_block, expect_ptree(), Ptree::First(), get_output_as_block(), Ptree_visitor< Annotator_RT >::get_source(), is_code(), Ptree::Second(), Ptree::Third(), and Paranoid_visitor< Annotator_RT >::visit_and_catch().

Annotator_RT Annotator::visit_brace PtreeBrace   p [virtual]
 

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 215 of file annotator.cc.

References Ptree::Car(), Ptree::Cdr(), expect_ptree(), Ptree::First(), is_code(), Ptree::Second(), Ptree::Third(), and Paranoid_visitor< Annotator_RT >::visit_and_catch().

Annotator_RT Annotator::visit_break PtreeBreakStatement   b [virtual]
 

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 822 of file annotator.cc.

References add_output(), expect_ptree(), Ptree::First(), and Ptree::Second().

Annotator_RT Annotator::visit_case PtreeCaseStatement   c [virtual]
 

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 780 of file annotator.cc.

References add_output(), compile_error(), current_scope, expect_ptree(), Ptree::First(), Ptree_visitor< Annotator_RT >::get_source(), Expr_result::get_tree(), Expr_result::get_type(), Type::is_enum_type(), Type::is_int(), Expr_result::is_value(), Ptree::List(), make_null_statement(), Ptree::Nth(), Ptree::Second(), Ptree::Third(), and Ptree_visitor< Annotator_RT >::visit().

Annotator_RT Annotator::visit_continue PtreeContinueStatement   c [virtual]
 

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 811 of file annotator.cc.

References add_output(), expect_ptree(), Ptree::First(), and Ptree::Second().

Annotator_RT Annotator::visit_default PtreeDefaultStatement   lbl [virtual]
 

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 766 of file annotator.cc.

References add_output(), expect_ptree(), Ptree::First(), Ptree::List(), make_null_statement(), Ptree::Second(), Ptree::Third(), and Ptree_visitor< Annotator_RT >::visit().

Annotator_RT Annotator::visit_do PtreeDoStatement   p [virtual]
 

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 436 of file annotator.cc.

References add_output(), compile_error(), current_block, current_scope, expect_ptree(), Ptree::First(), generate_implicit_conversion(), get_output_as_block(), Ptree_visitor< Annotator_RT >::get_source(), Expr_result::get_tree(), is_code(), Ptree::List(), Implicit_conversion::make_tree(), Ptree::Nth(), Ptree::Second(), Ptree::Third(), and visit_stmt_or_block().

Annotator_RT Annotator::visit_exprstatement PtreeExprStatement   p [virtual]
 

Expression or null statement.

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 558 of file annotator.cc.

References add_output(), Ptree::Cdr(), compile_error(), current_scope, expect_ptree(), Ptree::First(), Ptree_visitor< Annotator_RT >::get_source(), Expr_result::get_tree(), is_code(), Expr_result::is_value(), and Ptree::Second().

Annotator_RT Annotator::visit_for PtreeForStatement   p [virtual]
 

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 577 of file annotator.cc.

References add_output(), compile_error(), current_block, expect_ptree(), Ptree::First(), generate_implicit_conversion(), get_output_as_block(), Ptree_visitor< Annotator_RT >::get_source(), Expr_result::get_tree(), Expr_result::is_value(), Ptree::List(), make_null_statement(), Implicit_conversion::make_tree(), Ptree::Nth(), Ptree::Second(), Ptree::Snoc(), Ptree::Third(), Ptree_visitor< Annotator_RT >::visit(), and visit_stmt_or_block().

Annotator_RT Annotator::visit_function Ptree   storagespec,
Ptree   typespec,
PtreeDeclarator   decl,
PtreeBlock   block
[virtual]
 

Reimplemented from Ptree_program_visitor< Annotator_RT >.

Definition at line 173 of file annotator.cc.

References Declaration_reader::Arg_vec, current_scope, Ptree_visitor< Annotator_RT >::get_source(), HACK_EXPLICIT, Declaration_reader::parse_declarator(), Simple_declaration_reader::parse_specifiers(), parse_type(), and process_pending().

Annotator_RT Annotator::visit_goto PtreeGotoStatement   g [virtual]
 

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 800 of file annotator.cc.

References add_output(), expect_ptree(), Ptree::First(), and Ptree::Third().

Annotator_RT Annotator::visit_if PtreeIfStatement   p [virtual]
 

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 510 of file annotator.cc.

References add_output(), compile_error(), current_block, expect_ptree(), Ptree::First(), generate_implicit_conversion(), get_output_as_block(), Ptree_visitor< Annotator_RT >::get_source(), Expr_result::get_tree(), is_code(), Ptree::Length(), Ptree::List(), Implicit_conversion::make_tree(), Ptree::Nth(), Ptree::Second(), Ptree::Snoc(), Ptree::Third(), and visit_stmt_or_block().

Annotator_RT Annotator::visit_label PtreeLabelStatement   lbl [virtual]
 

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 750 of file annotator.cc.

References add_output(), expect_ptree(), Ptree::First(), Ptree::List(), make_null_statement(), Ptree::Second(), Ptree::Third(), and Ptree_visitor< Annotator_RT >::visit().

Annotator_RT Annotator::visit_linkagespec PtreeLinkageSpec   p [virtual]
 

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 206 of file annotator.cc.

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

Annotator_RT Annotator::visit_name_declaration Ptree   storagespec,
Ptree   typespec,
Ptree   decllist
[virtual]
 

Name declaration.

Parameters:
storagespec  list of static/mutable/friend/virtual/inline/extern
typespec  list of type specifiers and cv-qualifiers, or type definition
decllist  list of declarators, separated by comma

Reimplemented from Ptree_program_visitor< Annotator_RT >.

Definition at line 151 of file annotator.cc.

References Ptree::Car(), current_scope, Ptree::Eq(), Ptree_visitor< Annotator_RT >::get_source(), HACK_EXPLICIT, Declaration_reader::parse_declarator_list(), Simple_declaration_reader::parse_specifiers(), parse_type(), and process_pending().

Annotator_RT Annotator::visit_namespacespec PtreeNamespaceSpec   p [virtual]
 

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 339 of file annotator.cc.

References add_output_list(), Abstract_scope::add_symbol(), compile_error(), current_scope, expect_ptree(), Ptree::First(), Symbol::get_kind(), get_output(), Ptree_visitor< Annotator_RT >::get_source(), Symbol_name::get_unnamed_namespace_name(), Symbol::k_Namespace, Abstract_scope::lookup_here(), Ptree::Second(), Ptree::Third(), Ptree::ToString(), Symbol_pair::untag, and Ptree_visitor< Annotator_RT >::visit().

Annotator_RT Annotator::visit_nonleaf NonLeaf   p [virtual]
 

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 375 of file annotator.cc.

References Ptree::Car(), Ptree::Cdr(), and Paranoid_visitor< Annotator_RT >::visit_and_catch().

Annotator_RT Annotator::visit_return PtreeReturnStatement   p [virtual]
 

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 639 of file annotator.cc.

References add_output(), compile_error(), current_block, current_scope, expect_ptree(), Ptree::First(), generate_implicit_conversion(), Block_scope::get_function(), Type::get_human_readable_type(), Function_signature::get_return_type(), Ptree_visitor< Annotator_RT >::get_source(), Expr_result::get_tree(), Expr_result::get_type(), is_code(), Type::is_same_unqualified_type(), Expr_result::is_value(), Type::is_void(), Ptree::Length(), Ptree::List(), make_static_leaf(), Implicit_conversion::make_tree(), Ptree::Second(), and Ptree::Third().

void Annotator::visit_stmt_or_block Ptree   p
 

Definition at line 405 of file annotator.cc.

References Ptree::Car(), Ptree::Cdr(), Ptree::Second(), Ptree_visitor< Annotator_RT >::visit(), and Paranoid_visitor< Annotator_RT >::visit_and_catch().

Referenced by process_function_body(), visit_do(), visit_for(), visit_if(), visit_switch(), and visit_while().

Annotator_RT Annotator::visit_switch PtreeSwitchStatement   p [virtual]
 

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 685 of file annotator.cc.

References add_output(), compile_error(), Conversion_op_map, current_block, current_scope, enumerate_conversion_ops(), expect_ptree(), Ptree::First(), generate_implicit_conversion(), Type::get_human_readable_type(), get_output_as_block(), Ptree_visitor< Annotator_RT >::get_source(), Expr_result::get_tree(), Expr_result::get_type(), Type::is_class_type(), Type::is_enum_type(), Type::is_int(), Expr_result::is_value(), Ptree::List(), Implicit_conversion::make_tree(), Ptree::Nth(), Ptree::Second(), Ptree::Third(), and visit_stmt_or_block().

Annotator_RT Annotator::visit_templatedecl PtreeTemplateDecl   p [virtual]
 

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 190 of file annotator.cc.

References Ptree::Car(), current_scope, expect_ptree(), Ptree::Nth(), process_pending(), Ptree::Second(), and Ptree::Third().

Annotator_RT Annotator::visit_type_declaration Ptree   storagespec,
Ptree   typespec
[virtual]
 

Type declaration, i.e. lone "class Foo" in program.

Reimplemented from Ptree_program_visitor< Annotator_RT >.

Definition at line 305 of file annotator.cc.

References bogus_ptree_error(), Ptree::Car(), compile_warning(), current_scope, Ptree::Eq(), parse_type(), and process_pending().

Annotator_RT Annotator::visit_typedef PtreeTypedef   p [virtual]
 

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 283 of file annotator.cc.

References current_scope, Typedef_name_reader::get_name(), Declaration_reader::parse_declarator_list(), parse_type(), process_pending(), Ptree::Second(), and Ptree::Third().

Annotator_RT Annotator::visit_using PtreeUsing   p [virtual]
 

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 385 of file annotator.cc.

References bogus_ptree_error(), and Ptree::Second().

Annotator_RT Annotator::visit_while PtreeWhileStatement   p [virtual]
 

Reimplemented from Ptree_visitor< Annotator_RT >.

Definition at line 471 of file annotator.cc.

References add_output(), compile_error(), current_block, current_scope, expect_ptree(), Ptree::First(), generate_implicit_conversion(), get_output_as_block(), Ptree_visitor< Annotator_RT >::get_source(), Expr_result::get_tree(), is_code(), Ptree::List(), Implicit_conversion::make_tree(), Ptree::Nth(), Ptree::Second(), Ptree::Third(), and visit_stmt_or_block().


Member Data Documentation

Block_scope* Annotator::current_block [private]
 

Definition at line 35 of file annotator.h.

Referenced by is_code(), visit_block(), visit_do(), visit_for(), visit_if(), visit_return(), visit_switch(), and visit_while().

Abstract_scope* Annotator::current_scope [private]
 

Definition at line 34 of file annotator.h.

Referenced by process_pending(), visit_case(), visit_do(), visit_exprstatement(), visit_function(), visit_name_declaration(), visit_namespacespec(), visit_return(), visit_switch(), visit_templatedecl(), visit_type_declaration(), visit_typedef(), and visit_while().

Ptree* Annotator::output [private]
 

Definition at line 36 of file annotator.h.

Referenced by add_output(), add_output_list(), and get_output().


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