Index: lib/Frontend/ASTUnit.cpp =================================================================== --- lib/Frontend/ASTUnit.cpp +++ lib/Frontend/ASTUnit.cpp @@ -1391,30 +1391,30 @@ if (AnyFileChanged) break; - vfs::Status Status; - if (FileMgr->getNoncachedStatValue(R.second, Status)) { + const FileEntry *fileEntry = FileMgr->getFile(R.second); + if (!fileEntry) { // If we can't stat the file we're remapping to, assume that something // horrible happened. AnyFileChanged = true; break; } - OverriddenFiles[Status.getUniqueID()] = PreambleFileHash::createForFile( - Status.getSize(), - llvm::sys::toTimeT(Status.getLastModificationTime())); + OverriddenFiles[fileEntry->getUniqueID()] = PreambleFileHash::createForFile( + fileEntry->getSize(), + fileEntry->getModificationTime()); } for (const auto &RB : PreprocessorOpts.RemappedFileBuffers) { if (AnyFileChanged) break; - vfs::Status Status; - if (FileMgr->getNoncachedStatValue(RB.first, Status)) { + const FileEntry *fileEntry = FileMgr->getFile(RB.first); + if (!fileEntry) { AnyFileChanged = true; break; } - OverriddenFiles[Status.getUniqueID()] = + OverriddenFiles[fileEntry->getUniqueID()] = PreambleFileHash::createForMemoryBuffer(RB.second); } @@ -1423,15 +1423,15 @@ F = FilesInPreamble.begin(), FEnd = FilesInPreamble.end(); !AnyFileChanged && F != FEnd; ++F) { - vfs::Status Status; - if (FileMgr->getNoncachedStatValue(F->first(), Status)) { + const FileEntry *fileEntry = FileMgr->getFile(F->first()); + if (!fileEntry) { // If we can't stat the file, assume that something horrible happened. AnyFileChanged = true; break; } std::map::iterator Overridden - = OverriddenFiles.find(Status.getUniqueID()); + = OverriddenFiles.find(fileEntry->getUniqueID()); if (Overridden != OverriddenFiles.end()) { // This file was remapped; check whether the newly-mapped file // matches up with the previous mapping. @@ -1439,11 +1439,10 @@ AnyFileChanged = true; continue; } - + // The file was not remapped; check whether it has changed on disk. - if (Status.getSize() != uint64_t(F->second.Size) || - llvm::sys::toTimeT(Status.getLastModificationTime()) != - F->second.ModTime) + if (fileEntry->getSize() != F->second.Size || + fileEntry->getModificationTime() != F->second.ModTime) AnyFileChanged = true; } @@ -2063,6 +2062,8 @@ RemappedFile.second); } + FileMgr = new FileManager(FileMgr->getFileSystemOpts()); + // If we have a preamble file lying around, or if we might try to // build a precompiled preamble, do so now. std::unique_ptr OverrideMainBuffer; @@ -2071,7 +2072,6 @@ getMainBufferWithPrecompiledPreamble(PCHContainerOps, *Invocation); // Clear out the diagnostics state. - FileMgr.reset(); getDiagnostics().Reset(); ProcessWarningOptions(getDiagnostics(), Invocation->getDiagnosticOpts()); if (OverrideMainBuffer)