diff options
author | Julie Hockett <juliehockett@google.com> | 2019-07-10 18:41:35 +0000 |
---|---|---|
committer | Julie Hockett <juliehockett@google.com> | 2019-07-10 18:41:35 +0000 |
commit | c32742139ed3b95344157890781fe74ef98ba425 (patch) | |
tree | d7e311da0880b0b66e29516d6fa00582f68541d2 /clang/lib/Driver/ToolChains/Linux.cpp | |
parent | 1a2c8809248d10963e7bf547e0380816f1ff1ca1 (diff) | |
download | bcm5719-llvm-c32742139ed3b95344157890781fe74ef98ba425.tar.gz bcm5719-llvm-c32742139ed3b95344157890781fe74ef98ba425.zip |
Update libc++ include path detection to use VFS on Linux
The DetectLibcxxIncludePath function had been using
llvm::sys::fs::directory_iterator, and this updates it to use
llvm::vfs::directory_iterator.
Differential Revision: https://reviews.llvm.org/D64381
llvm-svn: 365682
Diffstat (limited to 'clang/lib/Driver/ToolChains/Linux.cpp')
-rw-r--r-- | clang/lib/Driver/ToolChains/Linux.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp index 4c82912a16f..442d7e97526 100644 --- a/clang/lib/Driver/ToolChains/Linux.cpp +++ b/clang/lib/Driver/ToolChains/Linux.cpp @@ -865,12 +865,13 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs, addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include"); } -static std::string DetectLibcxxIncludePath(StringRef base) { +static std::string DetectLibcxxIncludePath(llvm::vfs::FileSystem &vfs, + StringRef base) { std::error_code EC; int MaxVersion = 0; std::string MaxVersionString = ""; - for (llvm::sys::fs::directory_iterator LI(base, EC), LE; !EC && LI != LE; - LI = LI.increment(EC)) { + for (llvm::vfs::directory_iterator LI = vfs.dir_begin(base, EC), LE; + !EC && LI != LE; LI = LI.increment(EC)) { StringRef VersionText = llvm::sys::path::filename(LI->path()); int Version; if (VersionText[0] == 'v' && @@ -888,12 +889,12 @@ void Linux::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const { const std::string& SysRoot = computeSysRoot(); const std::string LibCXXIncludePathCandidates[] = { - DetectLibcxxIncludePath(getDriver().Dir + "/../include/c++"), + DetectLibcxxIncludePath(getVFS(), getDriver().Dir + "/../include/c++"), // If this is a development, non-installed, clang, libcxx will // not be found at ../include/c++ but it likely to be found at // one of the following two locations: - DetectLibcxxIncludePath(SysRoot + "/usr/local/include/c++"), - DetectLibcxxIncludePath(SysRoot + "/usr/include/c++") }; + DetectLibcxxIncludePath(getVFS(), SysRoot + "/usr/local/include/c++"), + DetectLibcxxIncludePath(getVFS(), SysRoot + "/usr/include/c++") }; for (const auto &IncludePath : LibCXXIncludePathCandidates) { if (IncludePath.empty() || !getVFS().exists(IncludePath)) continue; |