From: Sam McCall Date: Mon, 29 Jun 2020 21:05:07 +0000 (+0200) Subject: [clangd] config() -> Config::current to avoid confict with NS X-Git-Tag: llvmorg-12-init~1555 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1f14287eab972e76a521a32a2c326b8ff3b8d21f;p=platform%2Fupstream%2Fllvm.git [clangd] config() -> Config::current to avoid confict with NS --- diff --git a/clang-tools-extra/clangd/CompileCommands.cpp b/clang-tools-extra/clangd/CompileCommands.cpp index f9d5cccf..0b27e0e 100644 --- a/clang-tools-extra/clangd/CompileCommands.cpp +++ b/clang-tools-extra/clangd/CompileCommands.cpp @@ -184,7 +184,7 @@ CommandMangler CommandMangler::forTests() { void CommandMangler::adjust(std::vector &Cmd) const { // FIXME: remove const_cast once unique_function is const-compatible. - for (auto &Edit : const_cast(config()).CompileFlags.Edits) + for (auto &Edit : const_cast(Config::current()).CompileFlags.Edits) Edit(Cmd); // Check whether the flag exists, either as -flag or -flag=* diff --git a/clang-tools-extra/clangd/Config.cpp b/clang-tools-extra/clangd/Config.cpp index 699b03e..3b9b9bf 100644 --- a/clang-tools-extra/clangd/Config.cpp +++ b/clang-tools-extra/clangd/Config.cpp @@ -14,8 +14,8 @@ namespace clangd { Key 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; diff --git a/clang-tools-extra/clangd/Config.h b/clang-tools-extra/clangd/Config.h index c1c2cbb..878c9e8 100644 --- a/clang-tools-extra/clangd/Config.h +++ b/clang-tools-extra/clangd/Config.h @@ -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 ¤t(); /// Context key which can be used to set the current Config. static clangd::Key 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