-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Expand file tree
/
Copy pathObjectDomain.cpp
More file actions
45 lines (38 loc) · 1.05 KB
/
ObjectDomain.cpp
File metadata and controls
45 lines (38 loc) · 1.05 KB
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
#include "swift/extractor/trap/ObjectDomain.h"
namespace codeql {
ObjectDomain::ObjectDomain(TargetFile out) : out{std::move(out)} {
this->out << "TRAP dependencies 1.2\n";
}
void ObjectDomain::emitObject(const std::string& object) {
ensurePhase(Phase::objects);
out << object << '\n';
}
void ObjectDomain::emitObjectDependency(const std::string& object) {
ensurePhase(Phase::input_objects);
out << object << '\n';
}
void ObjectDomain::emitTrapDependency(const std::filesystem::path& trap) {
ensurePhase(Phase::traps);
out << trap.c_str() << '\n';
}
void ObjectDomain::ensurePhase(Phase phase) {
assert(phase >= current && "wrong order in .odep file attributes");
if (phase > current) {
switch (phase) {
case Phase::objects:
out << "OBJECTS\n";
break;
case Phase::input_objects:
out << "INPUT_OBJECTS\n";
break;
case Phase::traps:
out << "TRAPS\n";
break;
default:
assert(false && "unexpected phase");
break;
}
}
current = phase;
}
} // namespace codeql