Bump version to 19.1.0 (final)
[llvm-project.git] / clang-tools-extra / clangd / Feature.cpp
blob859618a7470aca6ebec37d3427d2354e7b54c74e
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-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "Feature.h"
10 #include "clang/Basic/Version.h"
11 #include "llvm/Support/Compiler.h"
12 #include "llvm/TargetParser/Host.h"
14 namespace clang {
15 namespace clangd {
17 std::string versionString() { return clang::getClangToolFullVersion("clangd"); }
19 std::string platformString() {
20 static std::string PlatformString = []() {
21 std::string Host = llvm::sys::getProcessTriple();
22 std::string Target = llvm::sys::getDefaultTargetTriple();
23 if (Host != Target) {
24 Host += "; target=";
25 Host += Target;
27 return Host;
28 }();
29 return PlatformString;
32 std::string featureString() {
33 return
34 #if defined(_WIN32)
35 "windows"
36 #elif defined(__APPLE__)
37 "mac"
38 #elif defined(__linux__)
39 "linux"
40 #elif defined(LLVM_ON_UNIX)
41 "unix"
42 #else
43 "unknown"
44 #endif
46 #ifndef NDEBUG
47 "+debug"
48 #endif
49 #if LLVM_ADDRESS_SANITIZER_BUILD
50 "+asan"
51 #endif
52 #if LLVM_THREAD_SANITIZER_BUILD
53 "+tsan"
54 #endif
55 #if LLVM_MEMORY_SANITIZER_BUILD
56 "+msan"
57 #endif
59 #if CLANGD_ENABLE_REMOTE
60 "+grpc"
61 #endif
62 #if CLANGD_BUILD_XPC
63 "+xpc"
64 #endif
66 #if !CLANGD_TIDY_CHECKS
67 "-tidy"
68 #endif
70 #if !CLANGD_DECISION_FOREST
71 "-decision_forest"
72 #endif
76 } // namespace clangd
77 } // namespace clang