1*bdd1243dSDimitry Andric//===- llvm/TargetParser/Win32/Host.inc -------------------------*- C++ -*-===// 2*bdd1243dSDimitry Andric// 3*bdd1243dSDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*bdd1243dSDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 5*bdd1243dSDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*bdd1243dSDimitry Andric// 7*bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 8*bdd1243dSDimitry Andric// 9*bdd1243dSDimitry Andric// This file implements the Win32 Host support. 10*bdd1243dSDimitry Andric// 11*bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 12*bdd1243dSDimitry Andric 13*bdd1243dSDimitry Andric// We need to include config.h here because LLVM_DEFAULT_TARGET_TRIPLE is not 14*bdd1243dSDimitry Andric// defined in llvm-config.h if it is unset. 15*bdd1243dSDimitry Andric#include "llvm/Config/config.h" 16*bdd1243dSDimitry Andric#include "llvm/Support/Windows/WindowsSupport.h" 17*bdd1243dSDimitry Andric#include <cstdio> 18*bdd1243dSDimitry Andric#include <string> 19*bdd1243dSDimitry Andric 20*bdd1243dSDimitry Andricusing namespace llvm; 21*bdd1243dSDimitry Andric 22*bdd1243dSDimitry Andricstatic std::string updateTripleOSVersion(std::string Triple) { return Triple; } 23*bdd1243dSDimitry Andric 24*bdd1243dSDimitry Andricstd::string sys::getDefaultTargetTriple() { 25*bdd1243dSDimitry Andric const char *Triple = LLVM_DEFAULT_TARGET_TRIPLE; 26*bdd1243dSDimitry Andric 27*bdd1243dSDimitry Andric // Override the default target with an environment variable named by 28*bdd1243dSDimitry Andric // LLVM_TARGET_TRIPLE_ENV. 29*bdd1243dSDimitry Andric#if defined(LLVM_TARGET_TRIPLE_ENV) 30*bdd1243dSDimitry Andric if (const char *EnvTriple = std::getenv(LLVM_TARGET_TRIPLE_ENV)) 31*bdd1243dSDimitry Andric Triple = EnvTriple; 32*bdd1243dSDimitry Andric#endif 33*bdd1243dSDimitry Andric 34*bdd1243dSDimitry Andric return Triple; 35*bdd1243dSDimitry Andric} 36