-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexpr.cpp
More file actions
32 lines (26 loc) · 676 Bytes
/
Copy pathexpr.cpp
File metadata and controls
32 lines (26 loc) · 676 Bytes
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
#include <string>
#include <stdio.h>
using namespace std;
#include "expr.h"
static int _id = 0xfa;
int expr_id() {
return _id++;
}
void expr_context::write(FILE *out) const {
for (const string &line : lines) {
fprintf(out, "%s\n", line.c_str());
}
}
string demangle(const string &name) {
char *type_name = abi::__cxa_demangle(name.c_str(), 0, 0, 0);
string type_name_str = type_name;
free(type_name);
return type_name_str;
}
void print_types(ostream &out, initializer_list<type_index> types) {
string comma = "";
for (const type_index &idx : types) {
out << comma << demangle(idx.name());
comma = ",";
}
}