This repository has been archived by the owner on Aug 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
log.cpp
123 lines (107 loc) · 1.82 KB
/
log.cpp
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#include "log.h"
#include "statement.h"
#include "rtl.h"
#include "exp.h"
#include "managed.h"
#include <sstream>
Log &Log::operator<<(Statement *s)
{
std::ostringstream st;
s->print(st);
*this << st.str().c_str();
return *this;
}
Log &Log::operator<<(Exp *e)
{
std::ostringstream st;
e->print(st);
*this << st.str().c_str();
return *this;
}
Log &Log::operator<<(Type *ty)
{
std::ostringstream st;
st << ty;
*this << st.str().c_str();
return *this;
}
Log &Log::operator<<(Range *r)
{
std::ostringstream st;
r->print(st);
*this << st.str().c_str();
return *this;
}
Log &Log::operator<<(Range &r)
{
std::ostringstream st;
r.print(st);
*this << st.str().c_str();
return *this;
}
Log &Log::operator<<(RangeMap &r)
{
std::ostringstream st;
r.print(st);
*this << st.str().c_str();
return *this;
}
Log &Log::operator<<(RTL *r)
{
std::ostringstream st;
r->print(st);
*this << st.str().c_str();
return *this;
}
Log &Log::operator<<(LocationSet *l)
{
std::ostringstream st;
st << l;
*this << st.str().c_str();
return *this;
}
Log &Log::operator<<(int i)
{
std::ostringstream st;
st << std::dec << i;
*this << st.str().c_str();
return *this;
}
Log &Log::operator<<(char c)
{
std::ostringstream st;
st << c;
*this << st.str().c_str();
return *this;
}
Log &Log::operator<<(double d)
{
std::ostringstream st;
st << d;
*this << st.str().c_str();
return *this;
}
Log &Log::operator<<(ADDRESS a)
{
std::ostringstream st;
st << "0x" << std::hex << a;
*this << st.str().c_str();
return *this;
}
#if 0 // Mac OS/X and 64 bit machines possibly need this, but better to just cast the size_t to unsigned
Log &Log::operator<<(size_t s)
{
std::ostringstream st;
st << st;
*this << st.str().c_str();
return *this;
}
#endif
void Log::tail()
{
}
void FileLogger::tail()
{
out.seekp(-200, std::ios::end);
std::cerr << out;
}