Commit d1888682 by rmrf

TemplateType object should not use pointers in containers

parent 6e5991b5
...@@ -43,7 +43,7 @@ bool FindPorts::VisitFieldDecl(FieldDecl *fd) { ...@@ -43,7 +43,7 @@ bool FindPorts::VisitFieldDecl(FieldDecl *fd) {
if (args.size() == 0) { if (args.size() == 0) {
return true; return true;
} }
string port_type{ (*ait)->getTypeName()}; string port_type{ ait->getTypeName()};
if (port_type == "sc_in") { if (port_type == "sc_in") {
// os_ << "\n+ sc_in"; // os_ << "\n+ sc_in";
_inPorts.insert(kvType(fname, te)); _inPorts.insert(kvType(fname, te));
......
...@@ -45,7 +45,7 @@ bool FindSensitivity::VisitMemberExpr(MemberExpr *e) { ...@@ -45,7 +45,7 @@ bool FindSensitivity::VisitMemberExpr(MemberExpr *e) {
return true; return true;
/// Is it a port type /// Is it a port type
string port_type{ (*ait)->getTypeName() }; string port_type{ ait->getTypeName() };
if (!(port_type == "sc_in" || port_type == "sc_out" || if (!(port_type == "sc_in" || port_type == "sc_out" ||
port_type == "sc_inout")) { port_type == "sc_inout")) {
return true; return true;
......
...@@ -40,7 +40,7 @@ bool FindTLMInterfaces::VisitFieldDecl(FieldDecl *fd) { ...@@ -40,7 +40,7 @@ bool FindTLMInterfaces::VisitFieldDecl(FieldDecl *fd) {
} }
// There could be more than one type though. Are you only referring to the first one? // There could be more than one type though. Are you only referring to the first one?
string template_type_name { (*ait)->getTypeName() }; string template_type_name { ait->getTypeName() };
if ( template_type_name == "sc_fifo_in") { if ( template_type_name == "sc_fifo_in") {
_inInterfaces.insert(kvType(fname, te)); _inInterfaces.insert(kvType(fname, te));
} }
......
...@@ -20,7 +20,10 @@ namespace scpar { ...@@ -20,7 +20,10 @@ namespace scpar {
class TemplateType { class TemplateType {
public: public:
TemplateType( string, const Type* ); TemplateType( string, const Type* );
string getTypeName(); ~TemplateType( );
TemplateType( const TemplateType& );
string getTypeName() const;
const Type* getTypePtr(); const Type* getTypePtr();
private: private:
...@@ -32,7 +35,7 @@ namespace scpar { ...@@ -32,7 +35,7 @@ namespace scpar {
class FindTemplateTypes : public RecursiveASTVisitor<FindTemplateTypes> { class FindTemplateTypes : public RecursiveASTVisitor<FindTemplateTypes> {
public: public:
/// Typedefs /// Typedefs
typedef TemplateType* TemplateTypePtr; typedef TemplateType TemplateTypePtr;
//typedef vector< TemplateTypePtr > type_vector_t_new; //typedef vector< TemplateTypePtr > type_vector_t_new;
//typedef vector<pair<string, const Type *>> type_vector_t; //typedef vector<pair<string, const Type *>> type_vector_t;
typedef vector< TemplateTypePtr > type_vector_t; typedef vector< TemplateTypePtr > type_vector_t;
...@@ -45,6 +48,8 @@ namespace scpar { ...@@ -45,6 +48,8 @@ namespace scpar {
/// Copy constructor /// Copy constructor
FindTemplateTypes(const FindTemplateTypes &rhs); FindTemplateTypes(const FindTemplateTypes &rhs);
FindTemplateTypes(const FindTemplateTypes *rhs); FindTemplateTypes(const FindTemplateTypes *rhs);
~FindTemplateTypes();
string getTemplateType(); string getTemplateType();
bool VisitType(Type *type); bool VisitType(Type *type);
bool VisitIntegerLiteral(IntegerLiteral *l); bool VisitIntegerLiteral(IntegerLiteral *l);
......
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