20 #include "llvm/Config/config.h" 23 #include <sys/utsname.h> 27 static std::string getOSVersion() {
36 static std::string updateTripleOSVersion(std::string TargetTripleString) {
38 std::string::size_type DarwinDashIdx = TargetTripleString.find(
"-darwin");
39 if (DarwinDashIdx != std::string::npos) {
40 TargetTripleString.resize(DarwinDashIdx + strlen(
"-darwin"));
41 TargetTripleString += getOSVersion();
42 return TargetTripleString;
44 std::string::size_type MacOSDashIdx = TargetTripleString.find(
"-macos");
45 if (MacOSDashIdx != std::string::npos) {
46 TargetTripleString.resize(MacOSDashIdx);
49 TargetTripleString +=
"-darwin";
50 TargetTripleString += getOSVersion();
58 if (uname(&
name) != -1) {
60 NewOSName +=
name.version;
62 NewOSName +=
name.release;
64 TT.setOSName(NewOSName);
69 return TargetTripleString;
73 std::string TargetTripleString =
74 updateTripleOSVersion(LLVM_DEFAULT_TARGET_TRIPLE);
78 #if defined(LLVM_TARGET_TRIPLE_ENV) 79 if (
const char *EnvTriple = std::getenv(LLVM_TARGET_TRIPLE_ENV))
80 TargetTripleString = EnvTriple;
83 return TargetTripleString;
This class represents lattice values for constants.
std::string getDefaultTargetTriple()
getDefaultTargetTriple() - Return the default target triple the compiler has been configured to produ...
static StringRef getOSTypeName(OSType Kind)
getOSTypeName - Get the canonical name for the Kind operating system.
Triple - Helper class for working with autoconf configuration names.