Commit 3e648365 authored by rmrf's avatar rmrf
Browse files

Continue cleaning up the code.

parent 5f9a6a6b
......@@ -10,42 +10,41 @@ string FindModule::getModuleName() {
return _moduleName;
}
FindModule::FindModule (CXXRecordDecl *d, llvm::raw_ostream &os):
_decl(d),
_os (os),
_isSystemCModule(false) {
if (d->hasDefinition () == true) {
TraverseDecl(d);
}
FindModule::FindModule(CXXRecordDecl *d, llvm::raw_ostream &os):
_decl{d},
_os{os},
_isSystemCModule{false} {
if ( d->hasDefinition () == true ) {
TraverseDecl(d);
}
}
bool FindModule::VisitCXXRecordDecl (CXXRecordDecl *d) {
if (_decl->getNumBases () <= 0) {
return true;
}
bool FindModule::VisitCXXRecordDecl( CXXRecordDecl *d ) {
if ( _decl->getNumBases () <= 0 ) {
return true;
}
for (CXXRecordDecl::base_class_iterator bi = _decl->bases_begin(),
be = _decl->bases_end(); bi != be; ++bi) {
QualType q = bi->getType();
string baseName = q.getAsString();
for (CXXRecordDecl::base_class_iterator bi = _decl->bases_begin(),
be = _decl->bases_end(); bi != be; ++bi) {
QualType q = bi->getType();
string baseName = q.getAsString();
if (baseName == "::sc_core::sc_module"
|| baseName == "sc_core::sc_module"
|| baseName == "class sc_core::sc_module") {
if (baseName == "::sc_core::sc_module"
|| baseName == "sc_core::sc_module"
|| baseName == "class sc_core::sc_module") {
_isSystemCModule = true;
IdentifierInfo *info = _decl->getIdentifier();
_isSystemCModule = true;
IdentifierInfo *info = _decl->getIdentifier();
if (info != NULL) {
_moduleName = info->getNameStart();
}
}
}
if ( info != nullptr ) {
_moduleName = info->getNameStart();
}
}
}
if (_isSystemCModule == false) {
return true;
}
if ( _isSystemCModule == false ) {
return true;
}
return false;
}
......@@ -57,10 +56,10 @@ FindModule::~FindModule() {
// Member functions
bool FindModule::isSystemCModule() const{
return _isSystemCModule;
}
bool FindModule::isSystemCModule() const {
return _isSystemCModule;
}
void FindModule::printSystemCModuleInformation() {
_os << "\n ============== FindModule ===============";
_os << "\n:> module name: " << _moduleName << ", CXXRecordDecl*: " <<
......
......@@ -12,19 +12,18 @@ namespace scpar {
class FindModule: public RecursiveASTVisitor < FindModule > {
public:
FindModule(CXXRecordDecl *, llvm::raw_ostream &);
virtual bool VisitCXXRecordDecl(CXXRecordDecl *decl);
FindModule( CXXRecordDecl *, llvm::raw_ostream & );
virtual bool VisitCXXRecordDecl( CXXRecordDecl *decl );
virtual ~FindModule();
void printSystemCModuleInformation();
string getModuleName();
bool isSystemCModule() const;
private:
CXXRecordDecl * _decl;
llvm::raw_ostream & _os;
CXXRecordDecl *_decl;
llvm::raw_ostream &_os;
bool _isSystemCModule;
string _moduleName;
......
......@@ -32,6 +32,11 @@ namespace scpar {
back_inserter (_templateTypes) );
}
FindTemplateTypes( const FindTemplateTypes *rhs ) {
copy (rhs->_templateTypes.begin(), rhs->_templateTypes.end(),
back_inserter (_templateTypes) );
}
string getTemplateType() {
string s{};
......@@ -92,22 +97,22 @@ namespace scpar {
}
void printTemplateArguments( llvm::raw_ostream &os, int tabn = 0 ) {
vector < string > template_arguments{ getTemplateArguments() };
vector < string > template_arguments; //{ getTemplateArguments() };
// type_vector_t::iterator
// for (auto mit = _templateTypes.begin(); mit != _templateTypes.end(); mit++) {
// for ( auto const &mit: _templateTypes ) {
/* for ( auto i{0}; i < tabn; ++i) { */
/* os << " "; */
/* } */
/* os << "- " << mit.first << ", type ptr: " << mit.second; */
/* os << "\n"; */
// template_arguments.push_back( mit.first );
// }
for ( auto const &mit: _templateTypes ) {
for ( auto i{0}; i < tabn; ++i) {
os << " ";
}
os << "- " << mit.first << ", type ptr: " << mit.second;
os << "\n";
template_arguments.push_back( mit.first );
}
// Print the template arguments to the output stream
os << "= ";
for ( auto const &targ: template_arguments ) {
os << targ << " ";
os << targ << " ";
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment