359cf1e322
- Refresh patches * aarch64-suse-support.patch * arm_suse_support.diff * assume-opensuse.patch * default-to-i586.patch - Drop upstream patches * llvm-disable-pretty-stack-trace.patch * r189852.diff * unreachable-code.patch OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm?expand=0&rev=287
79 lines
2.9 KiB
Diff
79 lines
2.9 KiB
Diff
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<llvm::MemoryBuffer> File;
|
|
- if (!llvm::MemoryBuffer::getFile("/etc/lsb-release", File)) {
|
|
- StringRef Data = File.get()->getBuffer();
|
|
- SmallVector<StringRef, 8> 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<Distro>(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.
|