From: Bruno Cardoso Lopes Date: Mon, 12 Dec 2016 19:28:21 +0000 (+0000) Subject: [Frontend] Use vfs for directory iteration while searching PCHs. NFCI X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4d61f224163e7197919e097f8e32debf832d370f;p=clang [Frontend] Use vfs for directory iteration while searching PCHs. NFCI Use the vfs lookup instead of real filesytem and handle the case where -include-pch is a directory and this dir is searched for a PCH. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289459 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp index 2945b8925f..e871b31030 100644 --- a/lib/Frontend/FrontendAction.cpp +++ b/lib/Frontend/FrontendAction.cpp @@ -288,14 +288,15 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, SmallString<128> DirNative; llvm::sys::path::native(PCHDir->getName(), DirNative); bool Found = false; - for (llvm::sys::fs::directory_iterator Dir(DirNative, EC), DirEnd; + vfs::FileSystem &FS = *FileMgr.getVirtualFileSystem(); + for (vfs::directory_iterator Dir = FS.dir_begin(DirNative, EC), DirEnd; Dir != DirEnd && !EC; Dir.increment(EC)) { // Check whether this is an acceptable AST file. if (ASTReader::isAcceptableASTFile( - Dir->path(), FileMgr, CI.getPCHContainerReader(), + Dir->getName(), FileMgr, CI.getPCHContainerReader(), CI.getLangOpts(), CI.getTargetOpts(), CI.getPreprocessorOpts(), SpecificModuleCachePath)) { - PPOpts.ImplicitPCHInclude = Dir->path(); + PPOpts.ImplicitPCHInclude = Dir->getName(); Found = true; break; }