systemc-clang
2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
src
SCuitable
Utility.cpp
Go to the documentation of this file.
1
#include "
Utility.h
"
2
3
using namespace
systemc_clang
;
4
/*
5
void Utility::tabit(raw_ostream &os, int tabn) {
6
for (int i = 0; i < tabn; i++) {
7
os << " ";
8
}
9
}
10
11
string Utility::strip(string s, string sub) {
12
// sub has "struct "
13
size_t pos = s.find(sub);
14
15
if (pos == string::npos) {
16
return s;
17
}
18
19
return s.erase(pos, sub.length());
20
}
21
22
template <typename vec> vec Utility::removeDuplicate(vec vecInput) {
23
for (unsigned int i = 0; i < vecInput.size(); i++) {
24
for (unsigned int j = 0; j < vecInput.size(); j++) {
25
if (i != j && vecInput.at(i) == vecInput.at(j)) {
26
vecInput.erase(vecInput.begin() + j);
27
}
28
}
29
}
30
return vecInput;
31
}
32
33
template <typename vec, typename element>
34
bool Utility::isElementPresent(vec vecInput, element elemInput) {
35
for (unsigned int i = 0; i < vecInput.size(); i++) {
36
if (elemInput == vecInput.at(i)) {
37
return true;
38
}
39
}
40
return false;
41
}
42
43
template <typename expressionArg> string getArgumentName(expressionArg *exp) {
44
if (exp == NULL) {
45
return string("NULL");
46
47
clang::LangOptions LangOpts;
48
LangOpts.CPlusPlus = true;
49
clang::PrintingPolicy Policy(LangOpts);
50
51
string TypeS;
52
53
llvm::raw_string_ostream s(TypeS);
54
55
exp->printPretty(s, 0, Policy);
56
57
return s.str();
58
}
59
}
60
61
Utility::Utility() {}
62
*/
Utility.h
A set of utility functions in the Utility class.
systemc_clang
Definition
SplitCFG.h:10
Generated by
1.12.0