clang-tools  14.0.0git
Feature.cpp
Go to the documentation of this file.
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 //===----------------------------------------------------------------------===//
8 
9 #include "Feature.h"
10 #include "clang/Basic/Version.h"
11 #include "llvm/Support/Compiler.h"
12 #include "llvm/Support/Host.h"
13 
14 namespace clang {
15 namespace clangd {
16 
17 std::string versionString() { return clang::getClangToolFullVersion("clangd"); }
18 
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;
26  }
27  return Host;
28  }();
29  return PlatformString;
30 }
31 
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
45 
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
58 
59 #if CLANGD_ENABLE_REMOTE
60  "+grpc"
61 #endif
62 #if CLANGD_BUILD_XPC
63  "+xpc"
64 #endif
65 
66 #if !CLANGD_TIDY_CHECKS
67  "-tidy"
68 #endif
69  ;
70 }
71 
72 } // namespace clangd
73 } // namespace clang
clang::clangd::versionString
std::string versionString()
Definition: Feature.cpp:17
Feature.h
clang::clangd::featureString
std::string featureString()
Definition: Feature.cpp:32
Target
std::string Target
Definition: QueryDriverDatabase.cpp:64
clang::clangd::platformString
std::string platformString()
Definition: Feature.cpp:19
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27