Skip to content

Commit f2b5016

Browse files
committed
[clang][cas] Handle CAS errors from OutputFile::keep()
When finishing output files we need to handle all possible Error kinds or we will have undefined behaviour. In particular, if storing to the CAS failed we could silently fail to add the main output leading to mysterious downstream failures if we tried to replay that compilation, or for modules when we tried to load the pcm contents. rdar://151077068
1 parent 56022c9 commit f2b5016

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

clang/lib/Frontend/CompilerInstance.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,10 @@ void CompilerInstance::clearOutputFiles(bool EraseFiles) {
898898
[&](const llvm::vfs::OutputError &E) {
899899
getDiagnostics().Report(diag::err_fe_unable_to_open_output)
900900
<< E.getOutputPath() << E.convertToErrorCode().message();
901+
},
902+
[&](const llvm::ErrorInfoBase &EIB) { // Handle any remaining error
903+
getDiagnostics().Report(diag::err_fe_unable_to_open_output)
904+
<< O.getPath() << EIB.message();
901905
});
902906
}
903907
OutputFiles.clear();

0 commit comments

Comments
 (0)