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