summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-02-06 15:33:06 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-02-06 15:33:06 +0000
commit3bb42f38f4c75de8859a3e1c0de229e2eff947fb (patch)
tree9c8ea0dd9a9010e2317cae60bbad6bef37e91926 /clang/lib/Driver
parenta2a9b9a3e89335a666359b000e58bf3c56f22549 (diff)
downloadbcm5719-llvm-3bb42f38f4c75de8859a3e1c0de229e2eff947fb.tar.gz
bcm5719-llvm-3bb42f38f4c75de8859a3e1c0de229e2eff947fb.zip
- Turn the other distribution checks into range compares.
- Turn openSUSE version parsing into a StringSwitch - Add an entry for Fedora release 16 (Verne) llvm-svn: 149872
Diffstat (limited to 'clang/lib/Driver')
-rw-r--r--clang/lib/Driver/ToolChains.cpp32
1 files changed, 14 insertions, 18 deletions
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp
index 15492774a5c..716e78de286 100644
--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/lib/Driver/ToolChains.cpp
@@ -1784,6 +1784,7 @@ enum LinuxDistro {
Fedora13,
Fedora14,
Fedora15,
+ Fedora16,
FedoraRawhide,
OpenSuse11_3,
OpenSuse11_4,
@@ -1801,19 +1802,16 @@ enum LinuxDistro {
};
static bool IsRedhat(enum LinuxDistro Distro) {
- return Distro == Fedora13 || Distro == Fedora14 ||
- Distro == Fedora15 || Distro == FedoraRawhide ||
- Distro == RHEL4 || Distro == RHEL5 || Distro == RHEL6;
+ return (Distro >= Fedora13 && Distro <= FedoraRawhide) ||
+ (Distro >= RHEL4 && Distro <= RHEL6);
}
static bool IsOpenSuse(enum LinuxDistro Distro) {
- return Distro == OpenSuse11_3 || Distro == OpenSuse11_4 ||
- Distro == OpenSuse12_1;
+ return Distro >= OpenSuse11_3 && Distro <= OpenSuse12_1;
}
static bool IsDebian(enum LinuxDistro Distro) {
- return Distro == DebianLenny || Distro == DebianSqueeze ||
- Distro == DebianWheezy;
+ return Distro >= DebianLenny && Distro <= DebianWheezy;
}
static bool IsUbuntu(enum LinuxDistro Distro) {
@@ -1845,7 +1843,9 @@ static LinuxDistro DetectLinuxDistro(llvm::Triple::ArchType Arch) {
if (!llvm::MemoryBuffer::getFile("/etc/redhat-release", File)) {
StringRef Data = File.get()->getBuffer();
- if (Data.startswith("Fedora release 15"))
+ if (Data.startswith("Fedora release 16"))
+ return Fedora16;
+ else if (Data.startswith("Fedora release 15"))
return Fedora15;
else if (Data.startswith("Fedora release 14"))
return Fedora14;
@@ -1879,16 +1879,12 @@ static LinuxDistro DetectLinuxDistro(llvm::Triple::ArchType Arch) {
return UnknownDistro;
}
- if (!llvm::MemoryBuffer::getFile("/etc/SuSE-release", File)) {
- StringRef Data = File.get()->getBuffer();
- if (Data.startswith("openSUSE 11.3"))
- return OpenSuse11_3;
- else if (Data.startswith("openSUSE 11.4"))
- return OpenSuse11_4;
- else if (Data.startswith("openSUSE 12.1"))
- return OpenSuse12_1;
- return UnknownDistro;
- }
+ if (!llvm::MemoryBuffer::getFile("/etc/SuSE-release", File))
+ return llvm::StringSwitch<LinuxDistro>(File.get()->getBuffer())
+ .StartsWith("openSUSE 11.3", OpenSuse11_3)
+ .StartsWith("openSUSE 11.4", OpenSuse11_4)
+ .StartsWith("openSUSE 12.1", OpenSuse12_1)
+ .Default(UnknownDistro);
bool Exists;
if (!llvm::sys::fs::exists("/etc/exherbo-release", Exists) && Exists)
OpenPOWER on IntegriCloud