r289459 - [Frontend] Use vfs for directory iteration while searching PCHs. NFCI
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 12 11:28:21 PST 2016
Author: bruno
Date: Mon Dec 12 13:28:21 2016
New Revision: 289459
URL: http://llvm.org/viewvc/llvm-project?rev=289459&view=rev
Log:
[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.
Modified:
cfe/trunk/lib/Frontend/FrontendAction.cpp
Modified: cfe/trunk/lib/Frontend/FrontendAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendAction.cpp?rev=289459&r1=289458&r2=289459&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendAction.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendAction.cpp Mon Dec 12 13:28:21 2016
@@ -288,14 +288,15 @@ bool FrontendAction::BeginSourceFile(Com
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;
}
More information about the cfe-commits
mailing list