[clang-tools-extra] 6342b38 - [clangd] Fix member/type name conflict caught by buildbots.

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 30 01:56:55 PDT 2020


Author: Sam McCall
Date: 2020-09-30T10:56:43+02:00
New Revision: 6342b38c5fee74df94d7b0c34e5a93b9b22763df

URL: https://github.com/llvm/llvm-project/commit/6342b38c5fee74df94d7b0c34e5a93b9b22763df
DIFF: https://github.com/llvm/llvm-project/commit/6342b38c5fee74df94d7b0c34e5a93b9b22763df.diff

LOG: [clangd] Fix member/type name conflict caught by buildbots.

Added: 
    

Modified: 
    clang-tools-extra/clangd/ClangdLSPServer.cpp
    clang-tools-extra/clangd/ClangdLSPServer.h
    clang-tools-extra/clangd/tool/ClangdMain.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp
index 4d9c0a43d68d..dfd26ad40b89 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -395,7 +395,7 @@ class ClangdLSPServer::MessageHandler : public Transport::MessageHandler {
   Context handlerContext() const {
     return Context::current().derive(
         kCurrentOffsetEncoding,
-        Server.Opts.OffsetEncoding.getValueOr(OffsetEncoding::UTF16));
+        Server.Opts.Encoding.getValueOr(OffsetEncoding::UTF16));
   }
 
   // We run cancelable requests in a context that does two things:
@@ -465,11 +465,11 @@ static std::vector<llvm::StringRef> semanticTokenTypes() {
 void ClangdLSPServer::onInitialize(const InitializeParams &Params,
                                    Callback<llvm::json::Value> Reply) {
   // Determine character encoding first as it affects constructed ClangdServer.
-  if (Params.capabilities.offsetEncoding && !Opts.OffsetEncoding) {
-    Opts.OffsetEncoding = OffsetEncoding::UTF16; // fallback
+  if (Params.capabilities.offsetEncoding && !Opts.Encoding) {
+    Opts.Encoding = OffsetEncoding::UTF16; // fallback
     for (OffsetEncoding Supported : *Params.capabilities.offsetEncoding)
       if (Supported != OffsetEncoding::UnsupportedEncoding) {
-        Opts.OffsetEncoding = Supported;
+        Opts.Encoding = Supported;
         break;
       }
   }
@@ -509,8 +509,8 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params,
     // Server, CDB, etc.
     WithContext MainContext(BackgroundContext.clone());
     llvm::Optional<WithContextValue> WithOffsetEncoding;
-    if (Opts.OffsetEncoding)
-      WithOffsetEncoding.emplace(kCurrentOffsetEncoding, *Opts.OffsetEncoding);
+    if (Opts.Encoding)
+      WithOffsetEncoding.emplace(kCurrentOffsetEncoding, *Opts.Encoding);
     Server.emplace(*CDB, TFS, Opts,
                    static_cast<ClangdServer::Callbacks *>(this));
   }
@@ -620,8 +620,8 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params,
              }},
             {"typeHierarchyProvider", true},
         }}}};
-  if (Opts.OffsetEncoding)
-    Result["offsetEncoding"] = *Opts.OffsetEncoding;
+  if (Opts.Encoding)
+    Result["offsetEncoding"] = *Opts.Encoding;
   if (Opts.TheiaSemanticHighlighting)
     Result.getObject("capabilities")
         ->insert(

diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.h b/clang-tools-extra/clangd/ClangdLSPServer.h
index 3dc679c59510..e8823d37c55d 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.h
+++ b/clang-tools-extra/clangd/ClangdLSPServer.h
@@ -44,7 +44,7 @@ class ClangdLSPServer : private ClangdServer::Callbacks {
     /// If not set, we search upward from the source file.
     llvm::Optional<Path> CompileCommandsDir;
     /// The offset-encoding to use, or None to negotiate it over LSP.
-    llvm::Optional<OffsetEncoding> OffsetEncoding;
+    llvm::Optional<OffsetEncoding> Encoding;
 
     /// Per-feature options. Generally ClangdServer lets these vary
     /// per-request, but LSP allows limited/no customizations.

diff  --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index 60a6c267591c..a897a9a3531d 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -820,7 +820,7 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var
     return true;
   };
   if (ForceOffsetEncoding != OffsetEncoding::UnsupportedEncoding)
-    Opts.OffsetEncoding = ForceOffsetEncoding;
+    Opts.Encoding = ForceOffsetEncoding;
 
   // Shall we allow to customize the file limit?
   Opts.Rename.AllowCrossFile = CrossFileRename;


        


More information about the cfe-commits mailing list