diff --git a/swift/extractor/main.cpp b/swift/extractor/main.cpp index f195193e5d7..82bc9cf1d73 100644 --- a/swift/extractor/main.cpp +++ b/swift/extractor/main.cpp @@ -227,7 +227,5 @@ int main(int argc, char** argv, char** envp) { observer.markSuccessfullyExtractedFiles(); } - codeql::Log::flush(); - return frontend_rc; } diff --git a/swift/logging/SwiftLogging.h b/swift/logging/SwiftLogging.h index 4a24996ad6e..d904a66553d 100644 --- a/swift/logging/SwiftLogging.h +++ b/swift/logging/SwiftLogging.h @@ -110,6 +110,8 @@ class Log { Level level; }; + ~Log() { flushImpl(); } + // Flush logs to the designated outputs static void flush() { instance().flushImpl(); } diff --git a/swift/xcode-autobuilder/XcodeBuildRunner.cpp b/swift/xcode-autobuilder/XcodeBuildRunner.cpp index 4c20440c3b9..675f56ab671 100644 --- a/swift/xcode-autobuilder/XcodeBuildRunner.cpp +++ b/swift/xcode-autobuilder/XcodeBuildRunner.cpp @@ -65,7 +65,6 @@ void buildTarget(Target& target, bool dryRun) { if (!exec(argv)) { DIAGNOSE_ERROR(build_command_failed, "The detected build command failed (tried {})", absl::StrJoin(argv, " ")); - codeql::Log::flush(); exit(1); } }