Puma Reference Manual Puma::CSemantic Class Reference



Puma::CSemantic Class Reference

#include <CSemantic.h>

Inheritance diagram for Puma::CSemantic:
Inheritance graph

Public Member Functions

 CSemantic (CSyntax &, CBuilder &)
 
virtual void init (CSemDatabase &, Unit &)
 Initialize the semantic analysis. More...
 
void configure (Config &)
 Configure the semantic analysis. More...
 
virtual CTreeid_expr ()
 
virtual CTreetypedef_name ()
 
virtual CTreeinit_declarator ()
 
virtual CTreeabst_declarator ()
 
virtual CTreedirect_abst_declarator ()
 
virtual CTreeparam_decl_clause ()
 
virtual CTreefinish_fct_def ()
 
virtual CTreearg_decl_seq ()
 
virtual CTreedecl_spec_seq1 ()
 
virtual CTreedecl_spec_seq_err ()
 
virtual CTreedeclare_parameter ()
 
virtual CTreeidentifier_list ()
 
virtual bool finish_param_check (bool)
 
virtual CTreebegin_decl ()
 
virtual CTreearray_delim ()
 
virtual CTreeenumerator_def ()
 
virtual CTreetrans_unit ()
 
virtual CTreeclass_spec ()
 
virtual CTreecmpd_stmt ()
 
virtual CTreeselect_stmt ()
 
virtual CTreeiter_stmt ()
 
virtual void introduce_label (CTree *&)
 
virtual CTreeintroduce_object (CTree *=0)
 
virtual CTreeintroduce_named_type ()
 
virtual CTreeintroduce_enum ()
 
virtual CTreeintroduce_enumerator ()
 
virtual CTreeintroduce_function ()
 
virtual CTreeintroduce_parameter ()
 
virtual CTreeintroduce_class ()
 
virtual CTreeintroduce_member ()
 
virtual CTreeintroduce_tag ()
 
void enter_arg_decl_seq ()
 
void leave_arg_decl_seq ()
 
void begin_param_check ()
 
bool in_arg_decl_seq () const
 
bool decl_spec_seq ()
 
bool empty_decl_spec_seq ()
 
virtual bool implicit_int ()
 
virtual CProtection::Type protection () const
 
void reenter_class_scope ()
 
void enter_scope (CStructure *scp)
 Enter the given scope. More...
 
void reenter_scope (CStructure *scp)
 Reenter the given scope. More...
 
void leave_scopes ()
 Leave all scopes entered up to the current scope. More...
 
- Public Member Functions inherited from Puma::Semantic
void error_sink (ErrorSink &e)
 Set the error output stream object. More...
 
void undo (CTree *tree)
 Undo the declaration analysis of the given syntax tree node. More...
 
CTreePrivateName ()
 Create a new anonymous (private) name. More...
 
void save_state ()
 Save the current semantic analysis state. More...
 
void forget_state ()
 Discard the saved semantic analysis state. More...
 
void restore_state ()
 Restore the saved semantic analysis state. More...
 
CFileInfogetFile ()
 Get the root node of the semantic tree. More...
 
void enter_local_scope ()
 Enter a local scope. More...
 
virtual void enter_param_decl_clause ()
 Enter a function parameter declaration clause. More...
 
virtual void leave_param_decl_clause ()
 Leave a function parameter declaration clause. More...
 
bool in_param_decl_clause ()
 Check if in the declaration of a function parameter clause. More...
 
void finish_decl ()
 Finish the analysis of the current declaration. More...
 
void finish_declarator ()
 Finish the analysis of the current declarator. More...
 
- Public Member Functions inherited from Puma::PtrStack< CObjectInfo >
 PtrStack (long=8192, long=8192)
 
virtual ~PtrStack ()
 
void Push (const CObjectInfo *)
 
void Pop ()
 
CObjectInfoTop () const
 
long Length () const
 
CObjectInfoGet (long) const
 
void New ()
 
void Forget ()
 
void Reject ()
 
void Destroy ()
 
long Stacks () const
 
void Reset ()
 

Protected Types

enum  SemObjType {
  CLASS,
  UNION,
  ENUM,
  TYPEDEF,
  FCT,
  ATTRIB,
  ARG,
  TAG,
  NON_TAG,
  ANY
}
 

Protected Member Functions

void declareImplicitFcts ()
 
virtual CBuilderbuilder () const
 
virtual CSyntaxsyntax () const
 
virtual void Delete ()
 Delete the top item on the semantic stack. More...
 
CObjectInfolookup (const char *, SemObjType, bool=false) const
 
CObjectInfolookup (CT_SimpleName *, SemObjType, bool=false) const
 
CObjectInfolookup (const char *, CStructure *, SemObjType, bool) const
 
CObjectInfolookupBuiltin (const char *name) const
 
CLinkage::Type determine_linkage (CSemDeclSpecs *, SemObjType, CObjectInfo *=(CObjectInfo *) 0) const
 
CStorage::Type determine_storage_class (CSemDeclSpecs *, SemObjType, CLinkage::Type) const
 
bool typeMatch (CTypeInfo *, CTypeInfo *) const
 
CStructurefindParent () const
 
void setSpecifiers (CObjectInfo *, CSemDeclSpecs *) const
 
bool isRedefiningTypedef (CObjectInfo *, int obj_type) const
 
bool isRedefinedFunction (CFunctionInfo *) const
 
CAttributeInfocreateAttribute (const char *, CStructure *, CTypeInfo *, bool=false)
 
CTypedefInfocreateTypedef (const char *, CStructure *, CTypeInfo *)
 
void createParameter (CFunctionInfo *, CTypeInfo *)
 
CFunctionInfocreateFunction (const char *, CStructure *, CTypeInfo *)
 
CTypeInforesolveExpr (CTree *expr, CTree *base) const
 
- Protected Member Functions inherited from Puma::Semantic
 Semantic ()
 Constructor. More...
 
virtual ~Semantic ()
 Destructor. More...
 
void common_settings (CObjectInfo *info, CTree *tree)
 Apply command settings on the given semantic object. More...
 
void common_settings (CObjectInfo *info, CTree *tree, CSemDeclarator *d)
 Apply command settings on the given semantic object. More...
 
void Push (CObjectInfo *info)
 Push the given semantic information object on the semantic stack. More...
 
bool in_decl () const
 Check if currently analysing a declaration. More...
 
void decl_begin (CSemDeclSpecs *ds)
 Begin analysing a declaration. More...
 
void decl_end ()
 Finish analysing a declaration. More...
 
void decl_specs_begin (CT_DeclSpecSeq *dss)
 Begin analysing a declaration specifier sequence. More...
 
void decl_specs_end ()
 Finish analysing a declaration specifier sequence. More...
 
CSemDeclSpecssem_decl_specs () const
 Get the semantic information for the currently analysed declaration specifier sequence. More...
 
CT_DeclSpecSeqdecl_specs () const
 Get the currently analysed declaration specifier sequence. More...
 
- Protected Member Functions inherited from Puma::PtrStack< CObjectInfo >
virtual void Remove ()
 

Protected Attributes

bool in_arg_decl
 
bool _in_arg_decl_seq
 
bool is_type_name
 
bool support_implicit_int
 
PtrStack< CStructurenon_record_scopes
 
- Protected Attributes inherited from Puma::Semantic
CSemDatabase_db
 Database of all semantic objects of the semantic tree. More...
 
CFileInfo_file
 Top level semantic object representing the file scope. More...
 
ErrorSink_err
 Error output stream. More...
 
long _Anonymous
 Counter for generating anonymous (private) names. More...
 
CEnumInfocurrent_enum
 The current enumeration, if inside the definition of an enumeration. More...
 
CStructurecurrent_fct
 The current function, if inside the definition of a function. More...
 
CStructurecurrent_scope
 The current scope. More...
 
BCStack< CSemDeclSpecs *, 256 > _sem_decl_specs
 Stack for the type analysis of declarations. More...
 
BCStack< CT_DeclSpecSeq *, 256 > _decl_specs
 Stack for collecting declaration specifiers. More...
 
BCStack< bool, 256 > _in_param_decl_clause
 Stack for the state of analysing a function parameter list. More...
 
BCStack< bool, 256 > _in_decl
 Stack for the state of analysing a declaration. More...
 

Member Enumeration Documentation

Enumerator
CLASS 
UNION 
ENUM 
TYPEDEF 
FCT 
ATTRIB 
ARG 
TAG 
NON_TAG 
ANY 

Constructor & Destructor Documentation

Puma::CSemantic::CSemantic ( CSyntax s,
CBuilder b 
)
inline

Member Function Documentation

virtual CTree* Puma::CSemantic::abst_declarator ( )
virtual
virtual CTree* Puma::CSemantic::arg_decl_seq ( )
virtual
virtual CTree* Puma::CSemantic::array_delim ( )
virtual
virtual CTree* Puma::CSemantic::begin_decl ( )
virtual
void Puma::CSemantic::begin_param_check ( )
CBuilder & Puma::CSemantic::builder ( ) const
inlineprotectedvirtual
virtual CTree* Puma::CSemantic::class_spec ( )
virtual

Reimplemented in Puma::CCSemantic.

virtual CTree* Puma::CSemantic::cmpd_stmt ( )
virtual
void Puma::CSemantic::configure ( Config c)
virtual

Configure the semantic analysis.

Parameters
cThe configuration settings.

Reimplemented from Puma::Semantic.

CAttributeInfo* Puma::CSemantic::createAttribute ( const char *  ,
CStructure ,
CTypeInfo ,
bool  = false 
)
protected
CFunctionInfo* Puma::CSemantic::createFunction ( const char *  ,
CStructure ,
CTypeInfo  
)
protected
void Puma::CSemantic::createParameter ( CFunctionInfo ,
CTypeInfo  
)
protected
CTypedefInfo* Puma::CSemantic::createTypedef ( const char *  ,
CStructure ,
CTypeInfo  
)
protected
bool Puma::CSemantic::decl_spec_seq ( )
virtual CTree* Puma::CSemantic::decl_spec_seq1 ( )
virtual

Reimplemented in Puma::CCSemantic.

virtual CTree* Puma::CSemantic::decl_spec_seq_err ( )
virtual
virtual CTree* Puma::CSemantic::declare_parameter ( )
virtual
void Puma::CSemantic::declareImplicitFcts ( )
inlineprotected
virtual void Puma::CSemantic::Delete ( )
protectedvirtual

Delete the top item on the semantic stack.

To be implemented by derived classes.

Reimplemented from Puma::Semantic.

Reimplemented in Puma::CCSemantic.

CLinkage::Type Puma::CSemantic::determine_linkage ( CSemDeclSpecs ,
SemObjType  ,
CObjectInfo = (CObjectInfo *) 0 
) const
protected
CStorage::Type Puma::CSemantic::determine_storage_class ( CSemDeclSpecs ,
SemObjType  ,
CLinkage::Type   
) const
protected
virtual CTree* Puma::CSemantic::direct_abst_declarator ( )
virtual
bool Puma::CSemantic::empty_decl_spec_seq ( )
void Puma::CSemantic::enter_arg_decl_seq ( )
inline
void Puma::CSemantic::enter_scope ( CStructure scope)
virtual

Enter the given scope.

Sets the parent of the entered scope to the current scope.

Parameters
scopeThe scope to enter.

Reimplemented from Puma::Semantic.

virtual CTree* Puma::CSemantic::enumerator_def ( )
virtual

Reimplemented in Puma::CCSemantic.

CStructure* Puma::CSemantic::findParent ( ) const
protected
virtual CTree* Puma::CSemantic::finish_fct_def ( )
virtual
virtual bool Puma::CSemantic::finish_param_check ( bool  )
virtual
virtual CTree* Puma::CSemantic::id_expr ( )
virtual
virtual CTree* Puma::CSemantic::identifier_list ( )
virtual
virtual bool Puma::CSemantic::implicit_int ( )
virtual

Reimplemented in Puma::CCSemantic.

bool Puma::CSemantic::in_arg_decl_seq ( ) const
inline
virtual void Puma::CSemantic::init ( CSemDatabase db,
Unit file 
)
virtual

Initialize the semantic analysis.

Parameters
dbThe semantic object database.
fileThe input file.

Reimplemented from Puma::Semantic.

Reimplemented in Puma::CCSemantic.

virtual CTree* Puma::CSemantic::init_declarator ( )
virtual

Reimplemented in Puma::CCSemantic.

virtual CTree* Puma::CSemantic::introduce_class ( )
virtual
virtual CTree* Puma::CSemantic::introduce_enum ( )
virtual

Reimplemented in Puma::CCSemantic.

virtual CTree* Puma::CSemantic::introduce_enumerator ( )
virtual

Reimplemented in Puma::CCSemantic.

virtual CTree* Puma::CSemantic::introduce_function ( )
virtual
virtual void Puma::CSemantic::introduce_label ( CTree *&  )
virtual
virtual CTree* Puma::CSemantic::introduce_member ( )
virtual

Reimplemented in Puma::CCSemantic.

virtual CTree* Puma::CSemantic::introduce_named_type ( )
virtual

Reimplemented in Puma::CCSemantic.

virtual CTree* Puma::CSemantic::introduce_object ( CTree = 0)
virtual
virtual CTree* Puma::CSemantic::introduce_parameter ( )
virtual

Reimplemented in Puma::CCSemantic.

virtual CTree* Puma::CSemantic::introduce_tag ( )
virtual

Reimplemented in Puma::CCSemantic.

bool Puma::CSemantic::isRedefinedFunction ( CFunctionInfo ) const
protected
bool Puma::CSemantic::isRedefiningTypedef ( CObjectInfo ,
int  obj_type 
) const
protected
virtual CTree* Puma::CSemantic::iter_stmt ( )
virtual
void Puma::CSemantic::leave_arg_decl_seq ( )
inline
void Puma::CSemantic::leave_scopes ( )
virtual

Leave all scopes entered up to the current scope.

Make the parent scope of the current scope to the current scope.

Reimplemented from Puma::Semantic.

CObjectInfo * Puma::CSemantic::lookup ( const char *  id,
SemObjType  type,
bool  nested = false 
) const
inlineprotected
CObjectInfo * Puma::CSemantic::lookup ( CT_SimpleName id,
SemObjType  type,
bool  nested = false 
) const
inlineprotected
CObjectInfo* Puma::CSemantic::lookup ( const char *  ,
CStructure ,
SemObjType  ,
bool   
) const
protected
CObjectInfo* Puma::CSemantic::lookupBuiltin ( const char *  name) const
protected
virtual CTree* Puma::CSemantic::param_decl_clause ( )
virtual
CProtection::Type Puma::CSemantic::protection ( ) const
inlinevirtual

Reimplemented in Puma::CCSemantic.

void Puma::CSemantic::reenter_class_scope ( )
void Puma::CSemantic::reenter_scope ( CStructure scope)
virtual

Reenter the given scope.

Does not reset the parent of entered scope.

Parameters
scopeThe scope to reenter.

Reimplemented from Puma::Semantic.

CTypeInfo* Puma::CSemantic::resolveExpr ( CTree expr,
CTree base 
) const
protected
virtual CTree* Puma::CSemantic::select_stmt ( )
virtual
void Puma::CSemantic::setSpecifiers ( CObjectInfo ,
CSemDeclSpecs  
) const
protected
CSyntax & Puma::CSemantic::syntax ( ) const
inlineprotectedvirtual
virtual CTree* Puma::CSemantic::trans_unit ( )
virtual
virtual CTree* Puma::CSemantic::typedef_name ( )
virtual

Reimplemented in Puma::CCSemantic.

bool Puma::CSemantic::typeMatch ( CTypeInfo ,
CTypeInfo  
) const
protected

Member Data Documentation

bool Puma::CSemantic::_in_arg_decl_seq
protected
bool Puma::CSemantic::in_arg_decl
protected
bool Puma::CSemantic::is_type_name
protected
PtrStack<CStructure> Puma::CSemantic::non_record_scopes
protected
bool Puma::CSemantic::support_implicit_int
protected



Puma Reference Manual. Created on Mon Oct 21 2013.