From e44e97794bb7f2413ce60d7623c36647ad242e29 Mon Sep 17 00:00:00 2001 From: rmrf Date: Wed, 11 Dec 2019 21:47:01 -0500 Subject: [PATCH] Run clang-format on it --- src/FindTemplateTypes.h | 98 ++++++++++++++++++++--------------------- src/Matchers.cpp | 1 + 2 files changed, 48 insertions(+), 51 deletions(-) diff --git a/src/FindTemplateTypes.h b/src/FindTemplateTypes.h index 272a0731b..284c08405 100644 --- a/src/FindTemplateTypes.h +++ b/src/FindTemplateTypes.h @@ -1,73 +1,69 @@ #ifndef _FIND_TEMPLATE_TYPES_H_ #define _FIND_TEMPLATE_TYPES_H_ +#include +#include #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 -#include #include 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 { - public: - /// Typedefs - typedef TemplateType TemplateTypePtr; - //typedef vector< TemplateTypePtr > type_vector_t_new; - //typedef vector> type_vector_t; - typedef vector< TemplateTypePtr > type_vector_t; - typedef vector< TemplateTypePtr > argVectorType; - //typedef vector> argVectorType; +// This class is going to find the arguments from templates +class FindTemplateTypes : public RecursiveASTVisitor { + public: + /// Typedefs + typedef TemplateType TemplateTypePtr; + typedef vector type_vector_t; + typedef vector 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 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 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 diff --git a/src/Matchers.cpp b/src/Matchers.cpp index 71105c07b..988dd8e69 100644 --- a/src/Matchers.cpp +++ b/src/Matchers.cpp @@ -117,6 +117,7 @@ finder.addMatcher( match_non_sc_types, this ); void ModuleDeclarationMatcher::run( const MatchFinder::MatchResult &result ) { if ( auto decl = const_cast(result.Nodes.getNodeAs("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) );