systemc-clang 2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
WaitContainer.cpp
Go to the documentation of this file.
1#include "WaitContainer.h"
2#include "llvm/Support/raw_ostream.h"
3
4using namespace systemc_clang;
5using namespace llvm;
6
8 // DO NOT free anything since nothing is dynamically allocated.
9
10 // Clear _args.
11 _args.clear();
12}
13
14WaitContainer::WaitContainer(CXXMethodDecl *m, CallExpr *c)
15 : _entryMethodDecl(m), _astNode(c), _numArgs(c->getNumArgs()) {
16 // Use CXXMemberCallExpr to populate the ARgMap.
18}
19
22 _astNode = from._astNode;
23 _numArgs = from._numArgs;
24
25 // TODO: Copy all strings (std::vector handles this)
26 _args = from._args;
27}
28
29unsigned int WaitContainer::getNumArgs() { return _numArgs; }
30
32
33CallExpr *WaitContainer::getASTNode() { return _astNode; }
34
36
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
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
63void 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}
CXXMethodDecl * getEntryMethod()
vector< string > waitArgVectorType
waitArgVectorType getArgList()
void dump(raw_ostream &, int tabn=0)
CXXMethodDecl * _entryMethodDecl