Commit 8876d137 authored by rmrf's avatar rmrf

Testing code formatting

parent f9d0bb96
......@@ -39,7 +39,7 @@ json FindGlobalEvents::dump_json() {
json globals_j{};
for ( auto const & event : globalEvents ) {
for ( auto const & event : _globalEvents ) {
globals_j["global_declarations"].emplace_back( event.first ) ;
}
std::cout << globals_j.dump(4) << endl;
......
......@@ -16,13 +16,13 @@ bool SystemCConsumer::fire() {
_systemcModel = new Model{} ;
// ANI : Do we need FindGlobalEvents?
FindGlobalEvents globals{tu, _os};
FindGlobalEvents globals{tu, os_};
FindGlobalEvents::globalEventMapType eventMap{globals.getEventMap()};
globals.dump_json();
_systemcModel->addGlobalEvents(eventMap);
// Find the sc_modules
FindSCModules scmod{tu, _os};
FindSCModules scmod{tu, os_};
FindSCModules::moduleMapType scmodules{scmod.getSystemCModulesMap()};
......@@ -30,22 +30,22 @@ bool SystemCConsumer::fire() {
mitend = scmodules.end(); mit != mitend; ++mit) {
ModuleDecl *md = new ModuleDecl{mit->first, mit->second};
//md->setTemplateParameters( scmod.getTemplateParameters() );
// _os << "SIZE: " << scmod.getTemplateParameters().size() << "\n";
// os_ << "SIZE: " << scmod.getTemplateParameters().size() << "\n";
_systemcModel->addModuleDecl(md);
}
////////////////////////////////////////////////////////////////
// Find the sc_main
////////////////////////////////////////////////////////////////
FindSCMain scmain{tu, _os};
FindSCMain scmain{tu, os_};
if (scmain.isSCMainFound()) {
FunctionDecl *fnDecl{scmain.getSCMainFunctionDecl()};
FindSimTime scstart{fnDecl, _os};
FindSimTime scstart{fnDecl, os_};
_systemcModel->addSimulationTime(scstart.returnSimTime());
} else {
_os << "\n Could not find SCMain";
os_ << "\n Could not find SCMain";
}
////////////////////////////////////////////////////////////////
......@@ -66,57 +66,57 @@ bool SystemCConsumer::fire() {
int numInstances{mainmd->getNumInstances()};
vector<ModuleDecl *> moduleDeclVec;
_os << "\n";
_os << "For module: " << mit->first << " num instance : " << numInstances;
os_ << "\n";
os_ << "For module: " << mit->first << " num instance : " << numInstances;
for (unsigned int num{0}; num < numInstances; ++num) {
ModuleDecl *md = new ModuleDecl{};
// Find the template arguments for the class.
FindTemplateParameters tparms{ mainmd->getModuleClassDecl(), _os};
FindTemplateParameters tparms{ mainmd->getModuleClassDecl(), os_};
md->setTemplateParameters( tparms.getTemplateParameters() );
_os << "@@# " << mainmd->getTemplateParameters().size() << "\n";
os_ << "@@# " << mainmd->getTemplateParameters().size() << "\n";
md->dump_json();
vector<EntryFunctionContainer *> _entryFunctionContainerVector;
FindConstructor constructor{mainmd->getModuleClassDecl(), _os};
FindConstructor constructor{mainmd->getModuleClassDecl(), os_};
md->addConstructor(constructor.returnConstructorStmt());
FindPorts ports{mainmd->getModuleClassDecl(), _os};
FindPorts ports{mainmd->getModuleClassDecl(), os_};
md->addInputPorts(ports.getInputPorts());
md->addOutputPorts(ports.getOutputPorts());
md->addInputOutputPorts(ports.getInputOutputPorts());
FindTLMInterfaces findTLMInterfaces{mainmd->getModuleClassDecl(), _os};
FindTLMInterfaces findTLMInterfaces{mainmd->getModuleClassDecl(), os_};
md->addInputInterfaces(findTLMInterfaces.getInputInterfaces());
md->addOutputInterfaces(findTLMInterfaces.getOutputInterfaces());
md->addInputOutputInterfaces(
findTLMInterfaces.getInputOutputInterfaces());
FindSignals signals{mainmd->getModuleClassDecl(), _os};
FindSignals signals{mainmd->getModuleClassDecl(), os_};
md->addSignals(signals.getSignals());
FindEntryFunctions findEntries{mainmd->getModuleClassDecl(), _os};
FindEntryFunctions findEntries{mainmd->getModuleClassDecl(), os_};
FindEntryFunctions::entryFunctionVectorType *entryFunctions{
findEntries.getEntryFunctions()};
md->addProcess(entryFunctions);
for (size_t i = 0; i < entryFunctions->size(); i++) {
EntryFunctionContainer *ef{(*entryFunctions)[i]};
FindSensitivity findSensitivity{constructor.returnConstructorStmt(), _os};
FindSensitivity findSensitivity{constructor.returnConstructorStmt(), os_};
ef->addSensitivityInfo(findSensitivity);
if (ef->getEntryMethod() == nullptr) {
_os << "ERROR";
os_ << "ERROR";
continue;
}
FindWait findWaits{ef->getEntryMethod(), _os};
FindWait findWaits{ef->getEntryMethod(), os_};
ef->addWaits(findWaits);
FindNotify findNotify{ef->_entryMethodDecl, _os};
FindNotify findNotify{ef->_entryMethodDecl, os_};
ef->addNotifys(findNotify);
/// Does not compile
......@@ -139,18 +139,18 @@ bool SystemCConsumer::fire() {
}
/*
FindSCMain scmain(tu, _os);
FindSCMain scmain(tu, os_);
if (scmain.isSCMainFound())
{
FunctionDecl *fnDecl = scmain.getSCMainFunctionDecl();
FindSimTime scstart(fnDecl, _os);
FindSimTime scstart(fnDecl, os_);
_systemcModel->addSimulationTime(scstart.returnSimTime());
}
else {
_os <<"\n Could not find SCMain";
os_ <<"\n Could not find SCMain";
}
FindNetlist findNetlist(scmain.getSCMainFunctionDecl());
......@@ -189,9 +189,9 @@ _systemcModel->addNetlist(findNetlist);
}
}
_os << "\n";
_os << "\n## SystemC model\n";
_systemcModel->dump(_os);
os_ << "\n";
os_ << "\n## SystemC model\n";
_systemcModel->dump(os_);
return true;
}
......@@ -219,7 +219,7 @@ void SystemCConsumer::HandleTranslationUnit(ASTContext &context) {
}
SystemCConsumer::SystemCConsumer(CompilerInstance &ci)
: _os{llvm::errs()}, _sm{ci.getSourceManager()},
: os_{llvm::errs()}, _sm{ci.getSourceManager()},
_context{ci.getASTContext()}, _ci{ci}, _systemcModel{nullptr} {}
SystemCConsumer::~SystemCConsumer() {
......
......@@ -60,7 +60,7 @@ namespace scpar {
class SystemCConsumer : public ASTConsumer,
public RecursiveASTVisitor<SystemCConsumer> {
public:
llvm::raw_ostream &_os;
llvm::raw_ostream &os_;
SourceManager &_sm;
SystemCConsumer(CompilerInstance &);
......
Markdown is supported
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