Skip to content

Commit ae1d65a

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 (cherry picked from commit f2b5016)
1 parent 0d47fa0 commit ae1d65a

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
@@ -902,6 +902,10 @@ void CompilerInstance::clearOutputFiles(bool EraseFiles) {
902902
[&](const llvm::vfs::OutputError &E) {
903903
getDiagnostics().Report(diag::err_fe_unable_to_open_output)
904904
<< E.getOutputPath() << E.convertToErrorCode().message();
905+
},
906+
[&](const llvm::ErrorInfoBase &EIB) { // Handle any remaining error
907+
getDiagnostics().Report(diag::err_fe_unable_to_open_output)
908+
<< O.getPath() << EIB.message();
905909
});
906910
}
907911
OutputFiles.clear();

0 commit comments

Comments
 (0)