Author: mgorny Date: Mon Oct 17 13:07:15 2016 New Revision: 284403 URL: http://llvm.org/viewvc/llvm-project?rev=284403&view=rev Log: [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 Modified: cfe/trunk/lib/Driver/ToolChains.cpp Modified: cfe/trunk/lib/Driver/ToolChains.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=284403&r1=284402&r2=284403&view=diff ============================================================================== --- cfe/trunk/lib/Driver/ToolChains.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct 17 13:07:15 2016 @@ -3844,7 +3844,7 @@ static bool IsUbuntu(enum Distro Distro) static Distro DetectDistro(const Driver &D, llvm::Triple::ArchType Arch) { llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> File = - llvm::MemoryBuffer::getFile("/etc/lsb-release"); + D.getVFS().getBufferForFile("/etc/lsb-release"); if (File) { StringRef Data = File.get()->getBuffer(); SmallVector<StringRef, 16> Lines; @@ -3876,7 +3876,7 @@ static Distro DetectDistro(const Driver 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 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') _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits