clang-tools 20.0.0git
Config.cpp
Go to the documentation of this file.
1//===--- Config.cpp - User configuration of clangd behavior ---------------===//
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 "Config.h"
10#include "support/Context.h"
11
12namespace clang {
13namespace clangd {
14
15Key<Config> Config::Key;
16
18 if (const Config *C = Context::current().get(Key))
19 return *C;
20 static Config Default;
21 return Default;
22}
23
24} // namespace clangd
25} // namespace clang
const Criteria C
static const Context & current()
Returns the context for the current thread, creating it if needed.
Definition: Context.cpp:27
Values in a Context are indexed by typed keys.
Definition: Context.h:40
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Settings that express user/project preferences and control clangd behavior.
Definition: Config.h:44
static clangd::Key< Config > Key
Context key which can be used to set the current Config.
Definition: Config.h:48
static const Config & current()
Returns the Config of the current Context, or an empty configuration.
Definition: Config.cpp:17