systemc-clang 2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
NotifyContainer.cpp
Go to the documentation of this file.
1#include "NotifyContainer.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
14NotifyContainer::NotifyContainer(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 NotifyContainer::getNumArgs() { return _numArgs; }
30
32
34
38
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
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
65void 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}
void dump(raw_ostream &, int tabn=0)