brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · ec707a3 Raw
79 lines · cpp
1//===--- Feature.cpp - Compile-time configuration ------------------------===//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-exception6//7//===----------------------------------------------------------------------===//8 9#include "Feature.h"10#include "clang/Basic/Version.h"11#include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX12#include "llvm/Support/Compiler.h"13#include "llvm/TargetParser/Host.h"14 15namespace clang {16namespace clangd {17 18std::string versionString() { return clang::getClangToolFullVersion("clangd"); }19 20std::string platformString() {21  static std::string PlatformString = []() {22    std::string Host = llvm::sys::getProcessTriple();23    std::string Target = llvm::sys::getDefaultTargetTriple();24    if (Host != Target) {25      Host += "; target=";26      Host += Target;27    }28    return Host;29  }();30  return PlatformString;31}32 33std::string featureString() {34  return35#if defined(_WIN32)36      "windows"37#elif defined(__APPLE__)38      "mac"39#elif defined(__linux__)40      "linux"41#elif defined(LLVM_ON_UNIX)42      "unix"43#else44      "unknown"45#endif46 47#ifndef NDEBUG48      "+debug"49#endif50#if LLVM_ADDRESS_SANITIZER_BUILD51      "+asan"52#endif53#if LLVM_THREAD_SANITIZER_BUILD54      "+tsan"55#endif56#if LLVM_MEMORY_SANITIZER_BUILD57      "+msan"58#endif59 60#if CLANGD_ENABLE_REMOTE61      "+grpc"62#endif63#if CLANGD_BUILD_XPC64      "+xpc"65#endif66 67#if !CLANGD_TIDY_CHECKS68      "-tidy"69#endif70 71#if !CLANGD_DECISION_FOREST72      "-decision_forest"73#endif74      ;75}76 77} // namespace clangd78} // namespace clang79