Author: Sam McCall
Date: 2020-06-29T23:05:19+02:00
New Revision: 1f14287eab972e76a521a32a2c326b8ff3b8d21f

URL: 
https://github.com/llvm/llvm-project/commit/1f14287eab972e76a521a32a2c326b8ff3b8d21f
DIFF: 
https://github.com/llvm/llvm-project/commit/1f14287eab972e76a521a32a2c326b8ff3b8d21f.diff

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

Added: 
    

Modified: 
    clang-tools-extra/clangd/CompileCommands.cpp
    clang-tools-extra/clangd/Config.cpp
    clang-tools-extra/clangd/Config.h

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/CompileCommands.cpp 
b/clang-tools-extra/clangd/CompileCommands.cpp
index f9d5cccf5baf..0b27e0e3e828 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<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=*

diff  --git a/clang-tools-extra/clangd/Config.cpp 
b/clang-tools-extra/clangd/Config.cpp
index 699b03e52484..3b9b9bf71e24 100644
--- a/clang-tools-extra/clangd/Config.cpp
+++ b/clang-tools-extra/clangd/Config.cpp
@@ -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;

diff  --git a/clang-tools-extra/clangd/Config.h 
b/clang-tools-extra/clangd/Config.h
index c1c2cbbd3a1e..878c9e8549b5 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 &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
 


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to