Skip to content

Commit 8e860e4

Browse files
HassanElDesoukyxedin
authored andcommitted
[tools] Handle errors when opening the YAML file
1 parent 3f40812 commit 8e860e4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tools/swift-def-to-yaml-converter/swift-def-to-yaml-converter.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ int main(int argc, char *argv[]) {
7272
llvm::raw_fd_ostream OS(LocalizedFilePath.str(), error,
7373
llvm::sys::fs::F_None);
7474

75+
if (OS.has_error() || error) {
76+
llvm::errs() << LocalizedFilePath.str() << " does not exist\n";
77+
return EXIT_FAILURE;
78+
}
79+
7580
for (unsigned i = 0; i < LocalDiagID::NumDiags; ++i) {
7681
OS << "- id: " << diagnosticID[i] << "\n";
7782
std::string msg = diagnosticMessages[i];

0 commit comments

Comments
 (0)