diff options
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r-- | clang/lib/Frontend/ASTUnit.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Frontend/CacheTokens.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Frontend/ChainedIncludesSource.cpp | 1 | ||||
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 7 | ||||
-rw-r--r-- | clang/lib/Frontend/FrontendAction.cpp | 3 |
5 files changed, 15 insertions, 6 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index 7f6ae5680e7..d617b368065 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -20,6 +20,7 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Basic/TargetInfo.h" #include "clang/Basic/TargetOptions.h" +#include "clang/Basic/VirtualFileSystem.h" #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/FrontendActions.h" #include "clang/Frontend/FrontendDiagnostic.h" @@ -37,7 +38,6 @@ #include "llvm/ADT/StringSet.h" #include "llvm/Support/Atomic.h" #include "llvm/Support/CrashRecoveryContext.h" -#include "llvm/Support/FileSystem.h" #include "llvm/Support/Host.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Mutex.h" @@ -1421,7 +1421,7 @@ llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble( REnd = PreprocessorOpts.remapped_file_end(); !AnyFileChanged && R != REnd; ++R) { - llvm::sys::fs::file_status Status; + vfs::Status Status; if (FileMgr->getNoncachedStatValue(R->second, Status)) { // If we can't stat the file we're remapping to, assume that something // horrible happened. @@ -1457,7 +1457,7 @@ llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble( } // The file was not remapped; check whether it has changed on disk. - llvm::sys::fs::file_status Status; + vfs::Status Status; if (FileMgr->getNoncachedStatValue(F->first(), Status)) { // If we can't stat the file, assume that something horrible happened. AnyFileChanged = true; diff --git a/clang/lib/Frontend/CacheTokens.cpp b/clang/lib/Frontend/CacheTokens.cpp index 0c30b049579..5cb364e3f5c 100644 --- a/clang/lib/Frontend/CacheTokens.cpp +++ b/clang/lib/Frontend/CacheTokens.cpp @@ -516,8 +516,8 @@ public: ~StatListener() {} LookupResult getStat(const char *Path, FileData &Data, bool isFile, - int *FileDescriptor) { - LookupResult Result = statChained(Path, Data, isFile, FileDescriptor); + vfs::File **F, vfs::FileSystem &FS) { + LookupResult Result = statChained(Path, Data, isFile, F, FS); if (Result == CacheMissing) // Failed 'stat'. PM.insert(PTHEntryKeyVariant(Path), PTHEntry()); diff --git a/clang/lib/Frontend/ChainedIncludesSource.cpp b/clang/lib/Frontend/ChainedIncludesSource.cpp index 442177ec319..d6d63bfb005 100644 --- a/clang/lib/Frontend/ChainedIncludesSource.cpp +++ b/clang/lib/Frontend/ChainedIncludesSource.cpp @@ -101,6 +101,7 @@ ChainedIncludesSource *ChainedIncludesSource::create(CompilerInstance &CI) { Clang->setDiagnostics(Diags.getPtr()); Clang->setTarget(TargetInfo::CreateTargetInfo(Clang->getDiagnostics(), &Clang->getTargetOpts())); + Clang->createVirtualFileSystem(); Clang->createFileManager(); Clang->createSourceManager(Clang->getFileManager()); Clang->createPreprocessor(); diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 61fe26c9222..0e9b0c0ebe3 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -194,9 +194,14 @@ CompilerInstance::createDiagnostics(DiagnosticOptions *Opts, return Diags; } +void CompilerInstance::createVirtualFileSystem() { + VirtualFileSystem = vfs::getRealFileSystem(); +} + // File Manager void CompilerInstance::createFileManager() { + assert(hasVirtualFileSystem() && "expected virtual file system"); FileMgr = new FileManager(getFileSystemOpts()); } @@ -867,6 +872,8 @@ static void compileModule(CompilerInstance &ImportingInstance, ImportingInstance.getDiagnosticClient()), /*ShouldOwnClient=*/true); + Instance.setVirtualFileSystem(&ImportingInstance.getVirtualFileSystem()); + // Note that this module is part of the module build stack, so that we // can detect cycles in the module graph. Instance.createFileManager(); // FIXME: Adopt file manager from importer? diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index 0baf3e5e1fb..4e04c2c0e83 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -159,7 +159,6 @@ ASTConsumer* FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI, return new MultiplexConsumer(Consumers); } - bool FrontendAction::BeginSourceFile(CompilerInstance &CI, const FrontendInputFile &Input) { assert(!Instance && "Already processing a source file!"); @@ -213,6 +212,8 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, } // Set up the file and source managers, if needed. + if (!CI.hasVirtualFileSystem()) + CI.createVirtualFileSystem(); if (!CI.hasFileManager()) CI.createFileManager(); if (!CI.hasSourceManager()) |