@@ -216,7 +216,8 @@ const unsigned DefaultPreambleRebuildInterval = 5;
216
216
static llvm::sys::cas_flag ActiveASTUnitObjects;
217
217
218
218
ASTUnit::ASTUnit (bool _MainFileIsAST)
219
- : Reader(0 ), OnlyLocalDecls(false ), CaptureDiagnostics(false ),
219
+ : Reader(0 ), HadModuleLoaderFatalFailure(false ),
220
+ OnlyLocalDecls(false ), CaptureDiagnostics(false ),
220
221
MainFileIsAST(_MainFileIsAST),
221
222
TUKind(TU_Complete), WantTiming(getenv(" LIBCLANG_TIMING" )),
222
223
OwnsRemappedFileBuffers(true ),
@@ -1705,6 +1706,7 @@ void ASTUnit::transferASTDataFromCompilerInstance(CompilerInstance &CI) {
1705
1706
CI.setFileManager (0 );
1706
1707
Target = &CI.getTarget ();
1707
1708
Reader = CI.getModuleManager ();
1709
+ HadModuleLoaderFatalFailure = CI.hadModuleLoaderFatalFailure ();
1708
1710
}
1709
1711
1710
1712
StringRef ASTUnit::getMainFileName () const {
@@ -2504,6 +2506,9 @@ void ASTUnit::CodeComplete(StringRef File, unsigned Line, unsigned Column,
2504
2506
}
2505
2507
2506
2508
bool ASTUnit::Save (StringRef File) {
2509
+ if (HadModuleLoaderFatalFailure)
2510
+ return true ;
2511
+
2507
2512
// Write to a temporary file and later rename it to the actual file, to avoid
2508
2513
// possible race conditions.
2509
2514
SmallString<128 > TempPath;
0 commit comments