[clangd] config() -> Config::current to avoid confict with NS

This commit is contained in:
Sam McCall 2020-06-29 23:05:07 +02:00
parent c48ccb6b4e
commit 1f14287eab
3 changed files with 8 additions and 9 deletions

View File

@ -184,7 +184,7 @@ CommandMangler CommandMangler::forTests() {
void CommandMangler::adjust(std::vector<std::string> &Cmd) const {
// FIXME: remove const_cast once unique_function is const-compatible.
for (auto &Edit : const_cast<Config &>(config()).CompileFlags.Edits)
for (auto &Edit : const_cast<Config &>(Config::current()).CompileFlags.Edits)
Edit(Cmd);
// Check whether the flag exists, either as -flag or -flag=*

View File

@ -14,8 +14,8 @@ namespace clangd {
Key<Config> Config::Key;
const Config &config() {
if (const Config *C = Context::current().get(Config::Key))
const Config &Config::current() {
if (const Config *C = Context::current().get(Key))
return *C;
static Config Default;
return Default;

View File

@ -34,10 +34,12 @@ namespace clangd {
/// Settings that express user/project preferences and control clangd behavior.
///
/// Generally, features should consume config() and the caller is responsible
/// for setting it appropriately. In practice these callers are ClangdServer,
/// TUScheduler, and BackgroundQueue.
/// Generally, features should consume Config::current() and the caller is
/// responsible for setting it appropriately. In practice these callers are
/// ClangdServer, TUScheduler, and BackgroundQueue.
struct Config {
/// Returns the Config of the current Context, or an empty configuration.
static const Config &current();
/// Context key which can be used to set the current Config.
static clangd::Key<Config> Key;
@ -55,9 +57,6 @@ struct Config {
} CompileFlags;
};
/// Returns the Config of the current Context, or an empty configuration.
const Config &config();
} // namespace clangd
} // namespace clang