Index: llvm/tools/clang/lib/Driver/ToolChains.cpp =================================================================== --- llvm.orig/tools/clang/lib/Driver/ToolChains.cpp +++ llvm/tools/clang/lib/Driver/ToolChains.cpp @@ -2185,73 +2185,7 @@ static bool IsUbuntu(enum Distro Distro) } static Distro DetectDistro(llvm::Triple::ArchType Arch) { - OwningPtr File; - if (!llvm::MemoryBuffer::getFile("/etc/lsb-release", File)) { - StringRef Data = File.get()->getBuffer(); - SmallVector Lines; - Data.split(Lines, "\n"); - Distro Version = UnknownDistro; - for (unsigned i = 0, s = Lines.size(); i != s; ++i) - if (Version == UnknownDistro && Lines[i].startswith("DISTRIB_CODENAME=")) - Version = llvm::StringSwitch(Lines[i].substr(17)) - .Case("hardy", UbuntuHardy) - .Case("intrepid", UbuntuIntrepid) - .Case("jaunty", UbuntuJaunty) - .Case("karmic", UbuntuKarmic) - .Case("lucid", UbuntuLucid) - .Case("maverick", UbuntuMaverick) - .Case("natty", UbuntuNatty) - .Case("oneiric", UbuntuOneiric) - .Case("precise", UbuntuPrecise) - .Case("quantal", UbuntuQuantal) - .Case("raring", UbuntuRaring) - .Case("saucy", UbuntuSaucy) - .Case("trusty", UbuntuTrusty) - .Default(UnknownDistro); - return Version; - } - - if (!llvm::MemoryBuffer::getFile("/etc/redhat-release", File)) { - StringRef Data = File.get()->getBuffer(); - if (Data.startswith("Fedora release")) - return Fedora; - else if (Data.startswith("Red Hat Enterprise Linux") && - Data.find("release 6") != StringRef::npos) - return RHEL6; - else if ((Data.startswith("Red Hat Enterprise Linux") || - Data.startswith("CentOS")) && - Data.find("release 5") != StringRef::npos) - return RHEL5; - else if ((Data.startswith("Red Hat Enterprise Linux") || - Data.startswith("CentOS")) && - Data.find("release 4") != StringRef::npos) - return RHEL4; - return UnknownDistro; - } - - if (!llvm::MemoryBuffer::getFile("/etc/debian_version", File)) { - StringRef Data = File.get()->getBuffer(); - if (Data[0] == '5') - return DebianLenny; - else if (Data.startswith("squeeze/sid") || Data[0] == '6') - return DebianSqueeze; - else if (Data.startswith("wheezy/sid") || Data[0] == '7') - return DebianWheezy; - else if (Data.startswith("jessie/sid") || Data[0] == '8') - return DebianJessie; - return UnknownDistro; - } - - if (llvm::sys::fs::exists("/etc/SuSE-release")) return OpenSUSE; - - if (llvm::sys::fs::exists("/etc/exherbo-release")) - return Exherbo; - - if (llvm::sys::fs::exists("/etc/arch-release")) - return ArchLinux; - - return UnknownDistro; } /// \brief Get our best guess at the multiarch triple for a target.