Skip to content

Commit 2904aa8

Browse files
committed
Revert "Swift: auto-flush logs at exit"
This reverts commit 0d9dcb1. This turns out to introduce a subtle bug related to destruction order between `Log::instance()` and the `Logger` instances.
1 parent 8f26c7e commit 2904aa8

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

swift/extractor/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,5 +227,7 @@ int main(int argc, char** argv, char** envp) {
227227
observer.markSuccessfullyExtractedFiles();
228228
}
229229

230+
codeql::Log::flush();
231+
230232
return frontend_rc;
231233
}

swift/logging/SwiftLogging.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ class Log {
110110
Level level;
111111
};
112112

113-
~Log() { flushImpl(); }
114-
115113
// Flush logs to the designated outputs
116114
static void flush() { instance().flushImpl(); }
117115

swift/xcode-autobuilder/XcodeBuildRunner.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ void buildTarget(Target& target, bool dryRun) {
7272
if (!exec(argv)) {
7373
DIAGNOSE_ERROR(build_command_failed, "The detected build command failed (tried {})",
7474
absl::StrJoin(argv, " "));
75+
codeql::Log::flush();
7576
exit(1);
7677
}
7778
}

0 commit comments

Comments
 (0)