From: Michal Gorny Date: Mon, 17 Oct 2016 18:07:15 +0000 (+0000) Subject: [Driver] Use VFS to perform all distribution checks X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=147b50f9a6934437647b4ba021697b9d83ec5644;p=clang [Driver] Use VFS to perform all distribution checks Use the VFS provided by D.getVFS() for all distribution checks, including those performing read of the release file. Requested by @bruno on D24954. Differential Revision: https://reviews.llvm.org/D25641 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284403 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index b51ae1c507..a9fd7ee719 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -3844,7 +3844,7 @@ static bool IsUbuntu(enum Distro Distro) { static Distro DetectDistro(const Driver &D, llvm::Triple::ArchType Arch) { llvm::ErrorOr> File = - llvm::MemoryBuffer::getFile("/etc/lsb-release"); + D.getVFS().getBufferForFile("/etc/lsb-release"); if (File) { StringRef Data = File.get()->getBuffer(); SmallVector Lines; @@ -3876,7 +3876,7 @@ static Distro DetectDistro(const Driver &D, llvm::Triple::ArchType Arch) { return Version; } - File = llvm::MemoryBuffer::getFile("/etc/redhat-release"); + File = D.getVFS().getBufferForFile("/etc/redhat-release"); if (File) { StringRef Data = File.get()->getBuffer(); if (Data.startswith("Fedora release")) @@ -3894,7 +3894,7 @@ static Distro DetectDistro(const Driver &D, llvm::Triple::ArchType Arch) { return UnknownDistro; } - File = llvm::MemoryBuffer::getFile("/etc/debian_version"); + File = D.getVFS().getBufferForFile("/etc/debian_version"); if (File) { StringRef Data = File.get()->getBuffer(); if (Data[0] == '5')