diff options
author | Ben Langmuir <blangmuir@apple.com> | 2018-03-23 17:37:27 +0000 |
---|---|---|
committer | Ben Langmuir <blangmuir@apple.com> | 2018-03-23 17:37:27 +0000 |
commit | 005c2e57a658bc18529de5027d52619dc4a2a72c (patch) | |
tree | 486d6d2a2869ab09f3065e360b8c7ba0689c5a7e /clang/lib/Frontend/ASTUnit.cpp | |
parent | a237866faff488edf9c822b38e16af3de13c0e90 (diff) | |
download | bcm5719-llvm-005c2e57a658bc18529de5027d52619dc4a2a72c.tar.gz bcm5719-llvm-005c2e57a658bc18529de5027d52619dc4a2a72c.zip |
[vfs] Don't bail out after a missing -ivfsoverlay file
This make -ivfsoverlay behave more like other fatal errors (e.g. missing
-include file) by skipping the missing file instead of bailing out of
the whole compilation. This makes it possible for libclang to still
provide some functionallity as well as to correctly produce the fatal
error diagnostic (previously we lost the diagnostic in libclang since
there was no TU to tie it to).
rdar://33385423
llvm-svn: 328337
Diffstat (limited to 'clang/lib/Frontend/ASTUnit.cpp')
-rw-r--r-- | clang/lib/Frontend/ASTUnit.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index cd3664bd3fc..1247e8219ff 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -1354,7 +1354,6 @@ ASTUnit::getMainBufferWithPrecompiledPreamble( case BuildPreambleError::CouldntCreateTargetInfo: case BuildPreambleError::BeginSourceFileFailed: case BuildPreambleError::CouldntEmitPCH: - case BuildPreambleError::CouldntCreateVFSOverlay: // These erros are more likely to repeat, retry after some period. PreambleRebuildCounter = DefaultPreambleRebuildInterval; return nullptr; @@ -1456,8 +1455,6 @@ ASTUnit::create(std::shared_ptr<CompilerInvocation> CI, ConfigureDiags(Diags, *AST, CaptureDiagnostics); IntrusiveRefCntPtr<vfs::FileSystem> VFS = createVFSFromCompilerInvocation(*CI, *Diags); - if (!VFS) - return nullptr; AST->Diagnostics = Diags; AST->FileSystemOpts = CI->getFileSystemOpts(); AST->Invocation = std::move(CI); @@ -1735,14 +1732,14 @@ ASTUnit *ASTUnit::LoadFromCommandLine( // Create the AST unit. std::unique_ptr<ASTUnit> AST; AST.reset(new ASTUnit(false)); + AST->NumStoredDiagnosticsFromDriver = StoredDiagnostics.size(); + AST->StoredDiagnostics.swap(StoredDiagnostics); ConfigureDiags(Diags, *AST, CaptureDiagnostics); AST->Diagnostics = Diags; AST->FileSystemOpts = CI->getFileSystemOpts(); if (!VFS) VFS = vfs::getRealFileSystem(); VFS = createVFSFromCompilerInvocation(*CI, *Diags, VFS); - if (!VFS) - return nullptr; AST->FileMgr = new FileManager(AST->FileSystemOpts, VFS); AST->PCMCache = new MemoryBufferCache; AST->OnlyLocalDecls = OnlyLocalDecls; @@ -1752,8 +1749,6 @@ ASTUnit *ASTUnit::LoadFromCommandLine( AST->IncludeBriefCommentsInCodeCompletion = IncludeBriefCommentsInCodeCompletion; AST->UserFilesAreVolatile = UserFilesAreVolatile; - AST->NumStoredDiagnosticsFromDriver = StoredDiagnostics.size(); - AST->StoredDiagnostics.swap(StoredDiagnostics); AST->Invocation = CI; if (ForSerialization) AST->WriterData.reset(new ASTWriterData(*AST->PCMCache)); |