Commit 4ba72524 authored by rmrf's avatar rmrf

Fix compile issue

parent 6abb2a2d
......@@ -28,7 +28,7 @@ add_library (libsystemc-clang
FindNetlist.cpp
FindArgument.cpp
FindTemplateParameters.cpp
# FindModuleInstance.cpp
FindModuleInstance.cpp
# Automata.cpp
# SuspensionAutomata.cpp
# SCuitable/GlobalSuspensionAutomata.cpp
......
#include "FindModuleInstance.h"
#include "FindTemplateTypes.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Type.h"
//#include "clang/Basic/SourceManager.h"
using namespace scpar;
string FindModuleInstance::getInstanceName() const { return instance_name_; }
FindModuleInstance::FindModuleInstance(CXXRecordDecl *declaration, llvm::raw_ostream &os)
: declaration_{declaration}, os_{os} {
if (declaration->hasDefinition() == true) {
TraverseDecl(declaration);
}
}
bool FindModuleInstance::VisitFieldDecl( FieldDecl *fdecl ) {
os_ << "#### FOUND FIELD DECL\n";
QualType q{fdecl->getType()};
string fname;
if (IdentifierInfo *info = fdecl->getIdentifier()) {
fname = info->getNameStart();
os_ << "\n+ Name: " << info->getNameStart();
os_ << "\n+ Type: " << q.getAsString();
}
fdecl->dump();
return true;
}
bool FindModuleInstance::VisitCXXConstructExpr(CXXConstructExpr*expr) {
os_ << "#### FOUND CONSTRUCTOR \n";
expr->dump();
return true;
}
FindModuleInstance::~FindModuleInstance() { declaration_ = nullptr; }
void FindModuleInstance::dump() {
os_ << "\n ============== FindModuleInstance ===============";
os_ << "\n:> module name: " << instance_name_
<< ", CXXRecordDecl*: " << declaration_
<< "\n";
os_ << "\n ============== END FindModuleInstance ===============";
}
#ifndef _FIND_MODULE_INSTANCE_H_
#define _FIND_MODULE_INSTANCE_H_
#include "clang/AST/DeclCXX.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "llvm/Support/raw_ostream.h"
namespace scpar {
using namespace clang;
using namespace std;
class FindModuleInstance : public RecursiveASTVisitor<FindModuleInstance> {
public:
FindModuleInstance(CXXRecordDecl *, llvm::raw_ostream &);
virtual bool VisitCXXConstructExpr(CXXConstructExpr *expr);
virtual bool VisitFieldDecl(FieldDecl *fdecl);
virtual ~FindModuleInstance();
void dump();
string getInstanceName() const;
private:
CXXRecordDecl *declaration_;
llvm::raw_ostream &os_;
string instance_name_;
};
} // namespace scpar
#endif
......@@ -51,7 +51,7 @@ using namespace clang::tooling;
#include "SuspensionAutomata.h"
#include "Utility.h"
#include "FindTemplateParameters.h"
//#include "FindModuleInstance.h"
#include "FindModuleInstance.h"
using namespace clang;
......
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