diff options
author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2016-12-12 19:28:21 +0000 |
---|---|---|
committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2016-12-12 19:28:21 +0000 |
commit | b4d56f1a4f972ed9ed0b5b7f61d749e025320027 (patch) | |
tree | 02864a147e8c453e1a6b873ffabb007cd730950b /clang/lib/Frontend/FrontendAction.cpp | |
parent | 4b75b8726d823680070f0c1723381bcdcc0f7791 (diff) | |
download | bcm5719-llvm-b4d56f1a4f972ed9ed0b5b7f61d749e025320027.tar.gz bcm5719-llvm-b4d56f1a4f972ed9ed0b5b7f61d749e025320027.zip |
[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.
llvm-svn: 289459
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r-- | clang/lib/Frontend/FrontendAction.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index 2945b8925f9..e871b310302 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/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; } |