summaryrefslogtreecommitdiff
path: root/lib/Support/Unix/Host.inc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/Unix/Host.inc')
-rw-r--r--lib/Support/Unix/Host.inc18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/Support/Unix/Host.inc b/lib/Support/Unix/Host.inc
index 726e2fbcf0..82f717fc39 100644
--- a/lib/Support/Unix/Host.inc
+++ b/lib/Support/Unix/Host.inc
@@ -35,13 +35,9 @@ static std::string getOSVersion() {
return info.release;
}
-std::string sys::getDefaultTargetTriple() {
- StringRef TargetTripleString(LLVM_DEFAULT_TARGET_TRIPLE);
- std::pair<StringRef, StringRef> ArchSplit = TargetTripleString.split('-');
-
- // Normalize the arch, since the target triple may not actually match the target.
+std::string getTriple(StringRef &TripleString) {
+ std::pair<StringRef, StringRef> ArchSplit = TripleString.split('-');
std::string Arch = ArchSplit.first;
-
std::string Triple(Arch);
Triple += '-';
Triple += ArchSplit.second;
@@ -61,3 +57,13 @@ std::string sys::getDefaultTargetTriple() {
return Triple;
}
+
+std::string sys::getDefaultTargetTriple() {
+ StringRef TargetTripleString(LLVM_DEFAULT_TARGET_TRIPLE);
+ return getTriple(TargetTripleString);
+}
+
+std::string sys::getHostTriple() {
+ StringRef HostTripleString(LLVM_HOST_TRIPLE);
+ return getTriple(HostTripleString);
+}