[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

llvm-svn: 284403
This commit is contained in:
Michal Gorny 2016-10-17 18:07:15 +00:00
parent ff5ee6a36a
commit 9e1b6e108e
1 changed files with 3 additions and 3 deletions

View File

@ -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 &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')