[PATCH] D25641: [Driver] Use VFS to perform all distribution checks
Michał Górny via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 15 00:45:53 PDT 2016
mgorny created this revision.
mgorny added reviewers: bruno, rafael, bkramer.
mgorny added subscribers: cfe-commits, bruno.
Use the VFS provided by D.getVFS() for all distribution checks,
including those performing read of the release file. Requested
by @bruno on https://reviews.llvm.org/D24954.
https://reviews.llvm.org/D25641
Files:
lib/Driver/ToolChains.cpp
Index: lib/Driver/ToolChains.cpp
===================================================================
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -3844,7 +3844,7 @@
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 @@
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 @@
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')
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25641.74767.patch
Type: text/x-patch
Size: 1084 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161015/23ffd91d/attachment.bin>
More information about the cfe-commits
mailing list