summaryrefslogtreecommitdiff
path: root/lib/Driver/Distro.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Driver/Distro.cpp')
-rw-r--r--lib/Driver/Distro.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Driver/Distro.cpp b/lib/Driver/Distro.cpp
index 2c4d44faf8d08..396d0bee5603c 100644
--- a/lib/Driver/Distro.cpp
+++ b/lib/Driver/Distro.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "clang/Driver/Distro.h"
+#include "clang/Basic/LLVM.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
@@ -17,7 +18,7 @@
using namespace clang::driver;
using namespace clang;
-static Distro::DistroType DetectDistro(vfs::FileSystem &VFS) {
+static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> File =
VFS.getBufferForFile("/etc/lsb-release");
if (File) {
@@ -50,6 +51,7 @@ static Distro::DistroType DetectDistro(vfs::FileSystem &VFS) {
.Case("artful", Distro::UbuntuArtful)
.Case("bionic", Distro::UbuntuBionic)
.Case("cosmic", Distro::UbuntuCosmic)
+ .Case("disco", Distro::UbuntuDisco)
.Default(Distro::UnknownDistro);
if (Version != Distro::UnknownDistro)
return Version;
@@ -136,7 +138,10 @@ static Distro::DistroType DetectDistro(vfs::FileSystem &VFS) {
if (VFS.exists("/etc/arch-release"))
return Distro::ArchLinux;
+ if (VFS.exists("/etc/gentoo-release"))
+ return Distro::Gentoo;
+
return Distro::UnknownDistro;
}
-Distro::Distro(vfs::FileSystem &VFS) : DistroVal(DetectDistro(VFS)) {}
+Distro::Distro(llvm::vfs::FileSystem &VFS) : DistroVal(DetectDistro(VFS)) {}