-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDataIO.hpp
66 lines (58 loc) · 2.23 KB
/
DataIO.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
#include "FriendStats.hpp"
#include "DataCrunching.hpp"
inline void print(const Result::FuncResult &funcRes) {
llvm::outs() << "friendDeclLoc: " << funcRes.friendDeclLocStr << "\n";
llvm::outs() << "defLoc: " << funcRes.defLocStr << "\n";
llvm::outs() << "diagName: " << funcRes.diagName << "\n";
llvm::outs() << "usedPrivateVarsCount: " << funcRes.usedPrivateVarsCount
<< "\n";
llvm::outs() << "parentPrivateVarsCount: " << funcRes.parentPrivateVarsCount
<< "\n";
llvm::outs() << "usedPrivateMethodsCount: " << funcRes.usedPrivateMethodsCount
<< "\n";
llvm::outs() << "parentPrivateMethodsCount: "
<< funcRes.parentPrivateMethodsCount << "\n";
llvm::outs() << "types.usedPrivateCount: " << funcRes.types.usedPrivateCount
<< "\n";
llvm::outs() << "types.parentPrivateCount: "
<< funcRes.types.parentPrivateCount << "\n";
}
inline void print(const Result::FuncResultKey &key) {
llvm::outs() << "befriending class: " << key.first << "\n"
<< "friendly function: " << key.second << "\n";
}
inline void
print(const Result::FuncResultsForFriendDecl::value_type &funcResPair) {
print(funcResPair.first);
print(funcResPair.second);
llvm::outs() << "============================================================"
"================\n";
}
inline void print(const ClassInfo& ci) {
llvm::outs() << "defLoc: " << ci.locStr << "\n";
llvm::outs() << "diagName: " << ci.diagName << "\n";
llvm::outs() << "============================================================"
"================\n";
}
inline raw_ostream &operator<<(raw_ostream &os,
const std::pair<int, int>& p) {
os << "(" << p.first << "," << p.second << ")";
return os;
}
template <typename T>
inline raw_ostream &operator<<(raw_ostream &os,
const DiscreteDistribution<T>& d) {
const auto& store = d.get();
for (const auto& v : store) {
std::string s;
llvm::raw_string_ostream ss{s};
ss << v.first;
if(ss.str().size() < 8) {
os << v.first << "\t\t" << v.second << "\n";
} else {
os << v.first << "\t" << v.second << "\n";
}
}
return os;
}