systemc-clang
2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
src
model
WaitContainer.cpp
Go to the documentation of this file.
1
#include "
WaitContainer.h
"
2
#include "llvm/Support/raw_ostream.h"
3
4
using namespace
systemc_clang
;
5
using namespace
llvm;
6
7
WaitContainer::~WaitContainer
() {
8
// DO NOT free anything since nothing is dynamically allocated.
9
10
// Clear _args.
11
_args
.clear();
12
}
13
14
WaitContainer::WaitContainer
(CXXMethodDecl *m, CallExpr *c)
15
: _entryMethodDecl(m), _astNode(c), _numArgs(c->getNumArgs()) {
16
// Use CXXMemberCallExpr to populate the ARgMap.
17
populateArgMap
();
18
}
19
20
WaitContainer::WaitContainer
(
const
WaitContainer
&from) {
21
_entryMethodDecl
= from.
_entryMethodDecl
;
22
_astNode
= from.
_astNode
;
23
_numArgs
= from.
_numArgs
;
24
25
// TODO: Copy all strings (std::vector handles this)
26
_args
= from.
_args
;
27
}
28
29
unsigned
int
WaitContainer::getNumArgs
() {
return
_numArgs
; }
30
31
CXXMethodDecl *
WaitContainer::getEntryMethod
() {
return
_entryMethodDecl
; }
32
33
CallExpr *
WaitContainer::getASTNode
() {
return
_astNode
; }
34
35
WaitContainer::waitArgVectorType
WaitContainer::getArgList
() {
return
_args
; }
36
37
string
WaitContainer::getArgString
(Expr *e) {
38
if
(!e) {
39
return
string(
"NULL"
);
40
}
41
42
LangOptions LO;
43
44
LO.CPlusPlus =
true
;
45
PrintingPolicy Policy(LO);
46
string
TypeS;
47
raw_string_ostream s(TypeS);
48
49
e->printPretty(s, 0, Policy);
50
return
s.str();
51
}
52
53
void
WaitContainer::populateArgMap
() {
54
if
(!
_astNode
) {
55
return
;
56
}
57
58
for
(
unsigned
int
i = 0; i <
_astNode
->getNumArgs(); i++) {
59
_args
.push_back(
getArgString
(
_astNode
->getArg(i)));
60
}
61
}
62
63
void
WaitContainer::dump
(raw_ostream &os,
int
tabn) {
64
for
(
int
i = 0; i < tabn; i++) {
65
os <<
" "
;
66
}
67
68
if
(
getNumArgs
() > 2) {
69
os <<
"WaitContainer numargs: "
<<
getNumArgs
() - 1 <<
" "
;
70
os <<
" arglist: "
;
71
for
(
unsigned
int
i = 0; i <
getNumArgs
() - 1; i++) {
72
os <<
"'"
<<
_args
[i] <<
"' "
;
73
}
74
}
else
{
75
os <<
"WaitContainer numargs: "
<<
getNumArgs
() <<
" "
;
76
if
(
getNumArgs
() > 0) {
77
os <<
" arglist: "
;
78
}
79
for
(
unsigned
int
i = 0; i <
getNumArgs
(); i++) {
80
os <<
"'"
<<
_args
[i] <<
"' "
;
81
}
82
}
83
84
os <<
"\n"
;
85
}
WaitContainer.h
systemc_clang::WaitContainer
Definition
WaitContainer.h:14
systemc_clang::WaitContainer::getArgString
string getArgString(Expr *e)
Definition
WaitContainer.cpp:37
systemc_clang::WaitContainer::getEntryMethod
CXXMethodDecl * getEntryMethod()
Definition
WaitContainer.cpp:31
systemc_clang::WaitContainer::waitArgVectorType
vector< string > waitArgVectorType
Definition
WaitContainer.h:17
systemc_clang::WaitContainer::_astNode
CallExpr * _astNode
Definition
WaitContainer.h:40
systemc_clang::WaitContainer::getASTNode
CallExpr * getASTNode()
Definition
WaitContainer.cpp:33
systemc_clang::WaitContainer::WaitContainer
WaitContainer()
systemc_clang::WaitContainer::~WaitContainer
~WaitContainer()
Definition
WaitContainer.cpp:7
systemc_clang::WaitContainer::populateArgMap
void populateArgMap()
Definition
WaitContainer.cpp:53
systemc_clang::WaitContainer::getArgList
waitArgVectorType getArgList()
Definition
WaitContainer.cpp:35
systemc_clang::WaitContainer::_args
waitArgVectorType _args
Definition
WaitContainer.h:43
systemc_clang::WaitContainer::getNumArgs
unsigned int getNumArgs()
Definition
WaitContainer.cpp:29
systemc_clang::WaitContainer::dump
void dump(raw_ostream &, int tabn=0)
Definition
WaitContainer.cpp:63
systemc_clang::WaitContainer::_entryMethodDecl
CXXMethodDecl * _entryMethodDecl
Definition
WaitContainer.h:39
systemc_clang::WaitContainer::_numArgs
unsigned int _numArgs
Definition
WaitContainer.h:41
systemc_clang
Definition
SplitCFG.h:10
Generated by
1.12.0