Skip to content

Commit c677c04

Browse files
committed
Swift: fix wrong if (diagnostics) block placement
1 parent ec3c63a commit c677c04

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

swift/logging/SwiftLogging.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -131,24 +131,24 @@ void Log::configure() {
131131
binary.level = Level::no_logs;
132132
text.level = Level::no_logs;
133133
}
134-
if (diagnostics) {
135-
std::filesystem::path diagFile =
136-
getEnvOr("CODEQL_EXTRACTOR_SWIFT_DIAGNOSTIC_DIR", "extractor-out/diagnostics");
137-
diagFile /= programName;
138-
diagFile /= logBaseName;
139-
diagFile.replace_extension(".jsonl");
140-
std::error_code ec;
141-
std::filesystem::create_directories(diagFile.parent_path(), ec);
142-
if (!ec) {
143-
if (!diagnostics.output.open(diagFile)) {
144-
problems.emplace_back("Unable to open diagnostics json file " + diagFile.string());
145-
diagnostics.level = Level::no_logs;
146-
}
147-
} else {
148-
problems.emplace_back("Unable to create diagnostics directory " +
149-
diagFile.parent_path().string() + ": " + ec.message());
134+
}
135+
if (diagnostics) {
136+
std::filesystem::path diagFile =
137+
getEnvOr("CODEQL_EXTRACTOR_SWIFT_DIAGNOSTIC_DIR", "extractor-out/diagnostics");
138+
diagFile /= programName;
139+
diagFile /= logBaseName;
140+
diagFile.replace_extension(".jsonl");
141+
std::error_code ec;
142+
std::filesystem::create_directories(diagFile.parent_path(), ec);
143+
if (!ec) {
144+
if (!diagnostics.output.open(diagFile)) {
145+
problems.emplace_back("Unable to open diagnostics json file " + diagFile.string());
150146
diagnostics.level = Level::no_logs;
151147
}
148+
} else {
149+
problems.emplace_back("Unable to create diagnostics directory " +
150+
diagFile.parent_path().string() + ": " + ec.message());
151+
diagnostics.level = Level::no_logs;
152152
}
153153
}
154154
for (const auto& problem : problems) {

0 commit comments

Comments
 (0)