Commit 279077f9 authored by rmrf's avatar rmrf

Clean up template parameters printing

parent edc9e2a4
......@@ -96,21 +96,17 @@ namespace scpar {
return template_types_;
}
void printTemplateArguments( llvm::raw_ostream &os, int tabn = 0 ) {
vector < string > template_arguments; //{ getTemplateArguments() };
// type_vector_t::iterator
// for (auto mit = template_types_.begin(); mit != template_types_.end(); mit++) {
void printTemplateArguments( llvm::raw_ostream &os ) {
vector < string > template_arguments;
for ( auto const &mit: template_types_ ) {
for ( auto i{0}; i < tabn; ++i) {
os << " ";
}
os << "- " << mit.first << ", type ptr: " << mit.second;
os << "\n";
//os << "\n port type: " << mit.first << " ";
//<< ", type ptr: " << mit.second;
//os << "\n";
template_arguments.push_back( mit.first );
}
// Print the template arguments to the output stream
os << "= ";
os << ", " << template_arguments.size() << " arguments, ";
for ( auto const &targ: template_arguments ) {
os << targ << " ";
}
......
......@@ -53,5 +53,5 @@ void InterfaceDecl::dump(raw_ostream & os, int tabn)
}
os << "InterfaceDecl " << this << " '" << _name << "' FindTemplateTypes " <<
_templateType;
_templateType->printTemplateArguments(os, 1);
_templateType->printTemplateArguments(os );
}
......@@ -5,41 +5,42 @@ using namespace scpar;
using namespace std;
PortDecl::~PortDecl() {
if ( _templateType != nullptr ) {
delete _templateType;
if ( template_type_ != nullptr ) {
delete template_type_;
}
}
PortDecl::PortDecl():_name{"NONE"}, _templateType{nullptr} {
PortDecl::PortDecl() :
port_name_{ "NONE" },
template_type_{ nullptr } {
}
PortDecl::PortDecl(const string &name, FindTemplateTypes *tt):_name{name}, _templateType{tt} {
PortDecl::PortDecl( const string &name, FindTemplateTypes *tt ) :
port_name_{ name },
template_type_{ tt } {
}
PortDecl::PortDecl(const PortDecl &from) {
_name = from._name;
PortDecl::PortDecl( const PortDecl &from ) {
port_name_ = from.port_name_;
// This is necessary to allow FindPorts to go out of scope.
_templateType = new FindTemplateTypes(*from._templateType);
template_type_ = new FindTemplateTypes{ *from.template_type_ };
}
void PortDecl::setModuleName(const string &name) {
_name = name;
void PortDecl::setModuleName( const string &name ) {
port_name_ = name;
}
string PortDecl::getName() const {
return _name;
return port_name_;
}
FindTemplateTypes *PortDecl::getTemplateType() {
return _templateType;
return template_type_;
}
void PortDecl::dump(raw_ostream & os, int tabn) {
for ( auto i = 0; i < tabn; ++i ) {
os << " ";
}
os << "PortDecl " << this << " '" << _name << "' FindTemplateTypes " <<
_templateType;
_templateType->printTemplateArguments(os, 1);
void PortDecl::dump( llvm::raw_ostream & os, int tabn ) {
//os << "PortDecl " << this << " '" << port_name_ << "' FindTemplateTypes " << template_type_;
os << "Port name: " << port_name_ << " ";
template_type_->printTemplateArguments( os );
}
......@@ -30,8 +30,8 @@ namespace scpar {
void dump(raw_ostream &, int tabn = 0);
private:
string _name;
FindTemplateTypes *_templateType;
string port_name_;
FindTemplateTypes *template_type_;
};
}
#endif
......@@ -66,5 +66,5 @@ void
}
os << "Signal " << this << " '" << _name << "' FindTemplateTypes " <<
_sig->getTemplateTypes () << "' FieldDecl' " << _sig->getASTNode ();
_sig->getTemplateTypes ()->printTemplateArguments (os, tabn);
_sig->getTemplateTypes ()->printTemplateArguments ( os );
}
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