Skip to content

Commit df84ed5

Browse files
committed
Swift: error printing in SwiftInvocationExtractor
1 parent a1cec3e commit df84ed5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

swift/extractor/invocation/SwiftInvocationExtractor.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@
44
#include "swift/extractor/trap/generated/TrapTags.h"
55
#include "swift/extractor/infra/file/TargetFile.h"
66
#include "swift/extractor/infra/file/Path.h"
7-
#include "swift/extractor/trap/LinkDomain.h"
7+
#include "swift/extractor/infra/log/SwiftAssert.h"
88

99
namespace fs = std::filesystem;
1010
using namespace std::string_literals;
1111

1212
namespace codeql {
1313
namespace {
14+
15+
Logger& logger() {
16+
static Logger ret{"invocation"};
17+
return ret;
18+
}
19+
1420
std::string getModuleId(const std::string_view& name, const std::string_view& hash) {
1521
auto ret = "module:"s;
1622
ret += name;
@@ -108,10 +114,8 @@ void replaceMergedModulesImplementation(const SwiftExtractorState& state,
108114
fs::copy(getTrapPath(state, mergeTarget, TrapType::linkage),
109115
getTrapPath(state, mergedPartTarget, TrapType::linkage),
110116
fs::copy_options::overwrite_existing, ec);
111-
if (ec) {
112-
std::cerr << "unable to replace trap implementation id for merged module '" << name << "' ("
113-
<< ec.message() << ")";
114-
}
117+
CODEQL_ASSERT(!ec, "Unable to replace trap implementation id for merged module '{}' ({})", name,
118+
ec);
115119
}
116120

117121
void emitModuleObjectDependencies(const SwiftExtractorState& state,

0 commit comments

Comments
 (0)