Skip to content

Commit

Permalink
Run clang-format on it
Browse files Browse the repository at this point in the history
  • Loading branch information
rmrf committed Dec 12, 2019
1 parent 4c0a1b8 commit e44e977
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 51 deletions.
98 changes: 47 additions & 51 deletions src/FindTemplateTypes.h
Original file line number Diff line number Diff line change
@@ -1,73 +1,69 @@
#ifndef _FIND_TEMPLATE_TYPES_H_
#define _FIND_TEMPLATE_TYPES_H_

#include <string>
#include <vector>
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/Type.h"
#include "llvm/Support/raw_ostream.h"
#include <string>
#include <vector>

#include <iostream>

namespace scpar {
using namespace clang;
using namespace std;
using namespace clang;
using namespace std;

// This class holds the name of the type, and a pointer to the
// type object.
class TemplateType {
public:
TemplateType( string, const Type* );
~TemplateType( );
TemplateType( const TemplateType& );
// This class holds the name of the type, and a pointer to the
// type object.
class TemplateType {
public:
TemplateType(string, const Type *);
~TemplateType();
TemplateType(const TemplateType &);

string getTypeName() const;
const Type* getTypePtr() const;
string getTypeName() const;
const Type *getTypePtr() const;

private:
string type_name_;
const Type * type_ptr_;
};
private:
string type_name_;
const Type *type_ptr_;
};

// This class is going to find the arguments from templates
class FindTemplateTypes : public RecursiveASTVisitor<FindTemplateTypes> {
public:
/// Typedefs
typedef TemplateType TemplateTypePtr;
//typedef vector< TemplateTypePtr > type_vector_t_new;
//typedef vector<pair<string, const Type *>> type_vector_t;
typedef vector< TemplateTypePtr > type_vector_t;
typedef vector< TemplateTypePtr > argVectorType;
//typedef vector<pair<string, const Type *>> argVectorType;
// This class is going to find the arguments from templates
class FindTemplateTypes : public RecursiveASTVisitor<FindTemplateTypes> {
public:
/// Typedefs
typedef TemplateType TemplateTypePtr;
typedef vector<TemplateTypePtr> type_vector_t;
typedef vector<TemplateTypePtr> argVectorType;

// Constructor
FindTemplateTypes();
// Constructor
FindTemplateTypes();

/// Copy constructor
FindTemplateTypes(const FindTemplateTypes &rhs);
FindTemplateTypes(const FindTemplateTypes *rhs);
/// Copy constructor
FindTemplateTypes(const FindTemplateTypes &rhs);
FindTemplateTypes(const FindTemplateTypes *rhs);

~FindTemplateTypes();
string getTemplateType();
bool VisitType(Type *type);
bool VisitIntegerLiteral(IntegerLiteral *l);
type_vector_t Enumerate(const Type *type);
type_vector_t getTemplateArgumentsType();
void printTemplateArguments(llvm::raw_ostream &os);
vector<string> getTemplateArguments();
size_t size();
~FindTemplateTypes();
string getTemplateType();
bool VisitType(Type *type);
bool VisitIntegerLiteral(IntegerLiteral *l);
type_vector_t Enumerate(const Type *type);
type_vector_t getTemplateArgumentsType();
void printTemplateArguments(llvm::raw_ostream &os);
vector<string> getTemplateArguments();
size_t size();

private:
// (string, Type*)
// Classes such as sc_port and sc_in can have nested types within it.
// For example: sc_in< sc_int<16> >
// The general way to handle this would be to have a vector starting from the
// outside type to the inside type.
private:
// (string, Type*)
// Classes such as sc_port and sc_in can have nested types within it.
// For example: sc_in< sc_int<16> >
// The general way to handle this would be to have a vector starting from the
// outside type to the inside type.

type_vector_t template_types_;
//type_vector_t_new template_types_new_;
};
} // namespace scpar
type_vector_t template_types_;
};
} // namespace scpar
#endif
1 change: 1 addition & 0 deletions src/Matchers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ finder.addMatcher( match_non_sc_types, this );
void ModuleDeclarationMatcher::run( const MatchFinder::MatchResult &result ) {

if ( auto decl = const_cast<CXXRecordDecl*>(result.Nodes.getNodeAs<CXXRecordDecl>("sc_module")) ) {

cout << " Found sc_module: " << decl->getIdentifier()->getNameStart() << endl;
std::string name{ decl->getIdentifier()->getNameStart() };
found_declarations_.push_back( std::make_tuple(name, decl) );
Expand Down

0 comments on commit e44e977

Please sign in to comment.