Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
caesr-pub
systemc-clang
Commits
4ba72524
Commit
4ba72524
authored
Aug 14, 2019
by
rmrf
Browse files
Fix compile issue
parent
6abb2a2d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
2 deletions
+80
-2
src/CMakeLists.txt
src/CMakeLists.txt
+1
-1
src/FindModuleInstance.cpp
src/FindModuleInstance.cpp
+48
-0
src/FindModuleInstance.h
src/FindModuleInstance.h
+30
-0
src/SystemCClang.h
src/SystemCClang.h
+1
-1
No files found.
src/CMakeLists.txt
View file @
4ba72524
...
...
@@ -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
...
...
src/FindModuleInstance.cpp
0 → 100644
View file @
4ba72524
#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 ==============="
;
}
src/FindModuleInstance.h
0 → 100644
View file @
4ba72524
#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
src/SystemCClang.h
View file @
4ba72524
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment