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 {
1212// Abstracts a given trap output file, with its own universe of trap labels
1313class TrapDomain {
1414 TargetFile out;
15- Logger logger{out. target (). filename ()};
15+ Logger logger{getLoggerName ()};
1616
1717 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+ }
1921
2022 template <typename Entry>
2123 void emit (const Entry& e) {
@@ -84,6 +86,17 @@ class TrapDomain {
8486 (oss << ... << keyParts);
8587 assignKey (label, oss.str ());
8688 }
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+ }
87100};
88101
89102} // namespace codeql
You can’t perform that action at this time.
0 commit comments