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