aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/FrontendActions.cpp
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2016-05-16 16:46:01 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2016-05-16 16:46:01 +0000
commitb171a59bfd152346ca068c73ccb61fe28643d024 (patch)
treefed5cea8a881988c786113364d0e70e4b86f6e99 /clang/lib/Frontend/FrontendActions.cpp
parentf3c7a3523857a4b8d6aa50bcc14e4a379d6388c7 (diff)
downloadllvm-b171a59bfd152346ca068c73ccb61fe28643d024.zip
llvm-b171a59bfd152346ca068c73ccb61fe28643d024.tar.gz
llvm-b171a59bfd152346ca068c73ccb61fe28643d024.tar.bz2
[Modules] Use vfs for (recursive) directory iteration
Clang performs directory walk while searching headers inside modules by using the ::sys::fs instead of ::vfs. This prevents any code that uses the VFS (e.g, reproducer scripts) to actually find such headers, since the VFS will never be searched for those. Change these places to use vfs::recursive_directory_iterator and vfs::directory_iterator instead. Differential Revision: http://reviews.llvm.org/D20266 rdar://problem/25880368 llvm-svn: 269661
Diffstat (limited to 'clang/lib/Frontend/FrontendActions.cpp')
-rw-r--r--clang/lib/Frontend/FrontendActions.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp
index 79c1df4..21dd37d 100644
--- a/clang/lib/Frontend/FrontendActions.cpp
+++ b/clang/lib/Frontend/FrontendActions.cpp
@@ -209,17 +209,18 @@ collectModuleHeaderIncludes(const LangOptions &LangOpts, FileManager &FileMgr,
std::error_code EC;
SmallString<128> DirNative;
llvm::sys::path::native(UmbrellaDir.Entry->getName(), DirNative);
- for (llvm::sys::fs::recursive_directory_iterator Dir(DirNative, EC),
- DirEnd;
- Dir != DirEnd && !EC; Dir.increment(EC)) {
+
+ vfs::FileSystem &FS = *FileMgr.getVirtualFileSystem();
+ for (vfs::recursive_directory_iterator Dir(FS, DirNative, EC), End;
+ Dir != End && !EC; Dir.increment(EC)) {
// Check whether this entry has an extension typically associated with
// headers.
- if (!llvm::StringSwitch<bool>(llvm::sys::path::extension(Dir->path()))
+ if (!llvm::StringSwitch<bool>(llvm::sys::path::extension(Dir->getName()))
.Cases(".h", ".H", ".hh", ".hpp", true)
.Default(false))
continue;
- const FileEntry *Header = FileMgr.getFile(Dir->path());
+ const FileEntry *Header = FileMgr.getFile(Dir->getName());
// FIXME: This shouldn't happen unless there is a file system race. Is
// that worth diagnosing?
if (!Header)
@@ -232,7 +233,7 @@ collectModuleHeaderIncludes(const LangOptions &LangOpts, FileManager &FileMgr,
// Compute the relative path from the directory to this file.
SmallVector<StringRef, 16> Components;
- auto PathIt = llvm::sys::path::rbegin(Dir->path());
+ auto PathIt = llvm::sys::path::rbegin(Dir->getName());
for (int I = 0; I != Dir.level() + 1; ++I, ++PathIt)
Components.push_back(*PathIt);
SmallString<128> RelativeHeader(UmbrellaDir.NameAsWritten);