[clangd] config() -> Config::current to avoid confict with NS
authorSam McCall <sam.mccall@gmail.com>
Mon, 29 Jun 2020 21:05:07 +0000 (23:05 +0200)
committerSam McCall <sam.mccall@gmail.com>
Mon, 29 Jun 2020 21:05:19 +0000 (23:05 +0200)
clang-tools-extra/clangd/CompileCommands.cpp
clang-tools-extra/clangd/Config.cpp
clang-tools-extra/clangd/Config.h

index f9d5ccc..0b27e0e 100644 (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=*
index 699b03e..3b9b9bf 100644 (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;
index c1c2cbb..878c9e8 100644 (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