[clang-tools-extra] Fix a link in ReleaseNotes.rst
[llvm-project.git] / clang-tools-extra / clangd / Feature.cpp
blob5664a8869bb0046fa4a60a362a4d502b5a92a839
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/Support/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
72 } // namespace clangd
73 } // namespace clang