[clangd] Fix member/type name conflict caught by buildbots.
authorSam McCall <sam.mccall@gmail.com>
Wed, 30 Sep 2020 08:56:43 +0000 (10:56 +0200)
committerSam McCall <sam.mccall@gmail.com>
Wed, 30 Sep 2020 08:56:43 +0000 (10:56 +0200)
clang-tools-extra/clangd/ClangdLSPServer.cpp
clang-tools-extra/clangd/ClangdLSPServer.h
clang-tools-extra/clangd/tool/ClangdMain.cpp

index 4d9c0a4..dfd26ad 100644 (file)
@@ -395,7 +395,7 @@ private:
   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(
index 3dc679c..e8823d3 100644 (file)
@@ -44,7 +44,7 @@ public:
     /// 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.
index 60a6c26..a897a9a 100644 (file)
@@ -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;