#include <decl_read.h>
Inheritance diagram for Declaration_reader:
Public Types | |
typedef std::vector< std::pair< Type, Ptree * > > | Arg_vec |
Public Methods | |
virtual void | declare_variable (Type type, Ptree *name, Ptree *initializer, Ptree *bitsize)=0 |
Abstract_scope * | get_scope () const |
Arg_vec * | get_args () const |
Declaration_reader (Abstract_scope *scope) | |
Create a general Declaration_reader. More... | |
Declaration_reader (Abstract_scope *scope, Arg_vec *args) | |
Create a Declaration_reader which collects function parameters. More... | |
virtual | ~Declaration_reader () |
void | parse_declarator (Type type, Ptree *tree) |
Read a declarator, and call declare_variable for it. More... | |
void | parse_declarator_list (Type type, Ptree *list) |
Read a declarator list. More... | |
Ptree * | parse_declarator_get_name (Ptree *tree) |
A boiled-down version of parse_declarator: parse declarator, and just return its name. More... | |
Private Methods | |
void | parse_declarator_internal (Type type, Ptree *tree, Ptree *initializer, Ptree *bitsize, Abstract_scope *scope) |
Private Attributes | |
Abstract_scope * | current_scope |
Block_scope * | block_scope |
Arg_vec * | function_args |
|
Definition at line 33 of file decl_read.h. Referenced by Simple_declaration_reader::declare_variable(), get_args(), Simple_declaration_reader::Simple_declaration_reader(), and Annotator::visit_function(). |
|
Create a general Declaration_reader. Names will be looked up in scope. Definition at line 14 of file decl_read.cc. References current_scope. |
|
Create a Declaration_reader which collects function parameters. This one only accepts one call to parse_declarator(), not parse_declarator_list().
Definition at line 29 of file decl_read.cc. References current_scope, and function_args. |
|
Definition at line 39 of file decl_read.cc. |
|
Implemented in Simple_declaration_reader, Typedef_name_reader, Typedef_declaration_reader, Function_declaration_reader, Ad_reader, and Name_decl_reader. Referenced by parse_declarator_internal(). |
|
Definition at line 39 of file decl_read.h. References Arg_vec, and function_args. Referenced by Simple_declaration_reader::declare_variable(). |
|
Definition at line 38 of file decl_read.h. Referenced by Typedef_declaration_reader::declare_variable(), and Simple_declaration_reader::declare_variable(). |
|
Read a declarator, and call declare_variable for it. Declarator syntax from standard: declarator: direct-declarator ptr-operator declarator direct-declarator: declarator-id direct-declarator ( parameter-declaration-clause ) cv-qualifier-seq opt exception-specification opt direct-declarator [ constant-expression opt ] ( declarator ) ptr-operator: cv-qualifier-seq opt & opt nested-name-specifier * cv-qualifier-seq opt "abstract-declarator" is essentially the same except that it has no "declarator-id". OpenC++ parses the above grammar and "flattens" it into one big list, including initializers and bitfields: declarator ::= identifier // sublist if qualified identifier | "*" : declarator | "&" : declarator | cv-qualifier : declarator | [ namepart... "::" "*" ] : declarator | declarator : postfix-expression* initializer? // declarator | postfix-expression* initializer? // abstract declarator postfix-expression ::= "(" : list-with-function-args : ")" ++ cv-qualifier-seq-opt | "[" : expression-with-array-size-or-nil : "]" initializer ::= "=" : expression | [ "(" : expression-list : ")" ] | ":" : expression // bitfield Definition at line 89 of file decl_read.cc. References current_scope, and parse_declarator_internal(). Referenced by parse_abstract_declarator(), parse_declarator_internal(), parse_declarator_list(), and Annotator::visit_function(). |
|
A boiled-down version of parse_declarator: parse declarator, and just return its name.
Definition at line 272 of file decl_read.cc. References bogus_ptree_error(), Ptree::Car(), Ptree::Cdr(), Ptree::Eq(), Ptree::IsLeaf(), Ptree::Length(), Ptree::Nth(), and parse_qualifier(). |
|
Definition at line 97 of file decl_read.cc. References Function_declaration_reader::add_ellipsis(), bogus_ptree_error(), Ptree::Car(), Ptree::Cdr(), compile_error(), declare_variable(), Ptree::Eq(), Ptree::First(), function_args, Class_scope::get_class_symbol(), Type::get_kind(), Function_declaration_reader::get_maker(), Symbol_name::get_name(), Symbol_name::get_scope(), Type_symbol::get_type(), Symbol_name::is_template(), Ptree::IsLeaf(), Type::k_Reference, Ptree::Length(), Type::make_array_type(), Function_type_maker::make_function_type(), Type::make_member_type(), Type::make_pointer_type(), Type::make_reference_type(), Ptree::Nth(), parse_declarator(), parse_qualifier(), parse_type(), and Ptree::Second(). Referenced by parse_declarator(). |
|
Read a declarator list. Syntax is decl-list ::= declarator | declarator "," decl-list Definition at line 253 of file decl_read.cc. References Ptree::Car(), Ptree::Cdr(), expect_ptree(), function_args, and parse_declarator(). Referenced by Annotator::visit_name_declaration(), and Annotator::visit_typedef(). |
|
Definition at line 31 of file decl_read.h. |
|
Definition at line 30 of file decl_read.h. Referenced by Declaration_reader(), and parse_declarator(). |
|
Definition at line 41 of file decl_read.h. Referenced by Declaration_reader(), get_args(), parse_declarator_internal(), and parse_declarator_list(). |