19#include "llvm/Config/config.h"
22#include <sys/utsname.h>
30static std::string getOSVersion() {
39static std::string updateTripleOSVersion(std::string TargetTripleString) {
41 std::string::size_type DarwinDashIdx = TargetTripleString.find(
"-darwin");
42 if (DarwinDashIdx != std::string::npos) {
43 TargetTripleString.resize(DarwinDashIdx + strlen(
"-darwin"));
44 TargetTripleString += getOSVersion();
45 return TargetTripleString;
47 std::string::size_type MacOSDashIdx = TargetTripleString.find(
"-macos");
48 if (MacOSDashIdx != std::string::npos) {
49 TargetTripleString.resize(MacOSDashIdx);
52 TargetTripleString +=
"-darwin";
53 TargetTripleString += getOSVersion();
61 if (uname(&
name) != -1) {
63 NewOSName +=
name.version;
65 NewOSName +=
name.release;
67 TT.setOSName(NewOSName);
72 return TargetTripleString;
76 std::string TargetTripleString =
77 updateTripleOSVersion(LLVM_DEFAULT_TARGET_TRIPLE);
81#if defined(LLVM_TARGET_TRIPLE_ENV)
82 if (
const char *EnvTriple = std::getenv(LLVM_TARGET_TRIPLE_ENV))
83 TargetTripleString = EnvTriple;
86 return TargetTripleString;
Triple - Helper class for working with autoconf configuration names.
static LLVM_ABI StringRef getOSTypeName(OSType Kind)
Get the canonical name for the Kind operating system.
LLVM_ABI std::string getDefaultTargetTriple()
getDefaultTargetTriple() - Return the default target triple the compiler has been configured to produ...
This is an optimization pass for GlobalISel generic memory operations.