systemc-clang 2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
sc_ast_matchers::ModuleDeclarationMatcher Class Reference

Class ModuleDeclarationMatcher. More...

#include <Matchers.h>

Inheritance diagram for sc_ast_matchers::ModuleDeclarationMatcher:
Collaboration diagram for sc_ast_matchers::ModuleDeclarationMatcher:

Public Types

typedef std::vector< InstanceMatcher::InstanceDeclTypeInstanceListType
 
typedef std::pair< clang::CXXRecordDecl *, ModuleInstance * > ModulePairType
 This will store all the modules as ModuleDecl.
 
typedef std::multimap< clang::CXXRecordDecl *, ModuleInstance * > ModuleMapType
 

Public Member Functions

const InstanceMatchergetInstanceMatcher ()
 
void registerMatchers (MatchFinder &finder)
 Register the matchers.
 
virtual void run (const MatchFinder::MatchResult &result)
 
const ModuleMapTypegetFoundModuleDeclarations () const
 
void runPortMatcher (ASTContext &context, const clang::CXXRecordDecl *decl, ModuleInstance *add_module)
 
void runModuleDeclarationMatchers (ASTContext &context, clang::CXXRecordDecl *cxx_decl, ModuleInstance *add_module_decl)
 
void matchInstancesInBaseClasses (ASTContext &context)
 
void processInstanceCXXDecls (ASTContext &context)
 
void dump ()
 

Private Attributes

ModuleMapType modules_
 
InstanceMatcher instance_matcher_
 

Detailed Description

Class ModuleDeclarationMatcher.

Definition at line 40 of file Matchers.h.

Member Typedef Documentation

◆ InstanceListType

◆ ModuleMapType

Definition at line 46 of file Matchers.h.

◆ ModulePairType

This will store all the modules as ModuleDecl.

Definition at line 45 of file Matchers.h.

Member Function Documentation

◆ dump()

void sc_ast_matchers::ModuleDeclarationMatcher::dump ( )
inline

Definition at line 270 of file Matchers.h.

◆ getFoundModuleDeclarations()

const ModuleMapType & sc_ast_matchers::ModuleDeclarationMatcher::getFoundModuleDeclarations ( ) const
inline

Definition at line 68 of file Matchers.h.

◆ getInstanceMatcher()

const InstanceMatcher & sc_ast_matchers::ModuleDeclarationMatcher::getInstanceMatcher ( )
inline

Definition at line 58 of file Matchers.h.

◆ matchInstancesInBaseClasses()

void sc_ast_matchers::ModuleDeclarationMatcher::matchInstancesInBaseClasses ( ASTContext & context)
inline

Copy contents over.

Definition at line 158 of file Matchers.h.

◆ processInstanceCXXDecls()

void sc_ast_matchers::ModuleDeclarationMatcher::processInstanceCXXDecls ( ASTContext & context)
inline
  1. The instances found so far are only the ValueDecls. However, there can be instances in base classes of the declarations of these ValueDecls that are not going to be recognized. As a result, we need to find those instances within the base classes of the identified ValueDecls.

Base classes may add instances. So we must get the updated instance_map.

DEBUG: output all the classes that have been identified. =======

END DEBUG ===========================================

Go through each identified instance, and identify any ports and module information.

TODO: Why do we need this when we can just access the instances and then get the decl?

Find if the instance CXXREcordDecl has a base class, and parse that too. Any ports, signals, etc. should be incorporated into the module instance.

Definition at line 190 of file Matchers.h.

◆ registerMatchers()

void sc_ast_matchers::ModuleDeclarationMatcher::registerMatchers ( MatchFinder & finder)
inline

Register the matchers.

Definition at line 61 of file Matchers.h.

◆ run()

virtual void sc_ast_matchers::ModuleDeclarationMatcher::run ( const MatchFinder::MatchResult & result)
inlinevirtual

Definition at line 66 of file Matchers.h.

◆ runModuleDeclarationMatchers()

void sc_ast_matchers::ModuleDeclarationMatcher::runModuleDeclarationMatchers ( ASTContext & context,
clang::CXXRecordDecl * cxx_decl,
ModuleInstance * add_module_decl )
inline
  1. Find constructor
  1. Find ports This is done for the declaration.

Add the sensitivity information to each of the entry functions.

Definition at line 95 of file Matchers.h.

◆ runPortMatcher()

void sc_ast_matchers::ModuleDeclarationMatcher::runPortMatcher ( ASTContext & context,
const clang::CXXRecordDecl * decl,
ModuleInstance * add_module )
inline

Definition at line 70 of file Matchers.h.

Member Data Documentation

◆ instance_matcher_

InstanceMatcher sc_ast_matchers::ModuleDeclarationMatcher::instance_matcher_
private

Definition at line 55 of file Matchers.h.

◆ modules_

ModuleMapType sc_ast_matchers::ModuleDeclarationMatcher::modules_
private

This will store the module instances as pair of CXXRecordDecl*, ModuleInstance*. The CXXRecordDecl* is the type of the sc_module, and ModuleInstance holds additional parsed information.

Definition at line 52 of file Matchers.h.


The documentation for this class was generated from the following file: