File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,12 @@ namespace codeql {
12
12
// Abstracts a given trap output file, with its own universe of trap labels
13
13
class TrapDomain {
14
14
TargetFile out;
15
- Logger logger{out. target (). filename ()};
15
+ Logger logger{getLoggerName ()};
16
16
17
17
public:
18
- explicit TrapDomain (TargetFile&& out) : out{std::move (out)} {}
18
+ explicit TrapDomain (TargetFile&& out) : out{std::move (out)} {
19
+ LOG_DEBUG (" writing trap file with target {}" , this ->out .target ());
20
+ }
19
21
20
22
template <typename Entry>
21
23
void emit (const Entry& e) {
@@ -84,6 +86,17 @@ class TrapDomain {
84
86
(oss << ... << keyParts);
85
87
assignKey (label, oss.str ());
86
88
}
89
+
90
+ std::string getLoggerName () {
91
+ // packaged swift modules are typically structured as
92
+ // `Module.swiftmodule/<arch_triple>.swiftmodule`, so the parent is more informative
93
+ // We use `Module.swiftmodule/.trap` then
94
+ if (auto parent = out.target ().parent_path (); parent.extension () == " .swiftmodule" ) {
95
+ return parent.filename () / " .trap" ;
96
+ } else {
97
+ return out.target ().filename ();
98
+ }
99
+ }
87
100
};
88
101
89
102
} // namespace codeql
You can’t perform that action at this time.
0 commit comments