//===--- ConfigFragment.h - Unit of user-specified configuration -*- C++-*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // Various clangd features have configurable behaviour (or can be disabled). // The configuration system allows users to control this: // - in a user config file, a project config file, via LSP, or via flags // - specifying different settings for different files // // This file defines the config::Fragment structure which models one piece of // configuration as obtained from a source like a file. // // This is distinct from how the config is interpreted (CompiledFragment), // combined (Provider) and exposed to the rest of clangd (Config). // //===----------------------------------------------------------------------===// // // To add a new configuration option, you must: // - add its syntactic form to Fragment // - update ConfigYAML.cpp to parse it // - add its semantic form to Config (in Config.h) // - update ConfigCompile.cpp to map Fragment -> Config // - make use of the option inside clangd // - document the new option (config.md in the llvm/clangd-www repository) // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_CONFIGFRAGMENT_H #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CONFIGFRAGMENT_H #include "ConfigProvider.h" #include "llvm/Support/SMLoc.h" #include "llvm/Support/SourceMgr.h" #include <optional> #include <string> #include <vector> namespace clang { namespace clangd { namespace config { /// An entity written in config along, with its optional location in the file. template <typename T> struct Located { … }; /// A chunk of configuration obtained from a config file, LSP, or elsewhere. struct Fragment { … }; } // namespace config } // namespace clangd } // namespace clang #endif