-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathLinkDomain.cpp
More file actions
37 lines (31 loc) · 843 Bytes
/
LinkDomain.cpp
File metadata and controls
37 lines (31 loc) · 843 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
32
33
34
35
36
37
#include "swift/extractor/trap/LinkDomain.h"
namespace codeql {
LinkDomain::LinkDomain(TargetFile out) : out{std::move(out)} {
this->out << "Linker invocation 1.0\n";
}
void LinkDomain::emitTarget(const std::string& target) {
ensurePhase(Phase::target);
out << target << '\n';
}
void LinkDomain::emitObjectDependency(const std::string& object) {
ensurePhase(Phase::objects);
out << object << '\n';
}
void LinkDomain::ensurePhase(Phase phase) {
assert(phase >= current && "wrong order in .link file attributes");
if (phase > current) {
switch (phase) {
case Phase::target:
out << "TARGET\n";
break;
case Phase::objects:
out << "OBJECTS\n";
break;
default:
assert(false && "unexpected phase");
break;
}
}
current = phase;
}
} // namespace codeql