[PATCH] D130003: [clangd] Use empty string to represent None semantics in FoldingRange::kind

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 18 06:02:11 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0496cf2f6a2e: [clangd] Use empty string to represent None semantics in FoldingRange::kind (authored by kadircet).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130003/new/

https://reviews.llvm.org/D130003

Files:
  clang-tools-extra/clangd/Protocol.cpp
  clang-tools-extra/clangd/Protocol.h


Index: clang-tools-extra/clangd/Protocol.h
===================================================================
--- clang-tools-extra/clangd/Protocol.h
+++ clang-tools-extra/clangd/Protocol.h
@@ -1772,7 +1772,7 @@
   unsigned startCharacter;
   unsigned endLine = 0;
   unsigned endCharacter;
-  llvm::Optional<std::string> kind;
+  std::string kind;
 };
 llvm::json::Value toJSON(const FoldingRange &Range);
 
Index: clang-tools-extra/clangd/Protocol.cpp
===================================================================
--- clang-tools-extra/clangd/Protocol.cpp
+++ clang-tools-extra/clangd/Protocol.cpp
@@ -1444,8 +1444,8 @@
     Result["startCharacter"] = Range.startCharacter;
   if (Range.endCharacter)
     Result["endCharacter"] = Range.endCharacter;
-  if (Range.kind)
-    Result["kind"] = *Range.kind;
+  if (!Range.kind.empty())
+    Result["kind"] = Range.kind;
   return Result;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130003.445471.patch
Type: text/x-patch
Size: 899 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220718/7032ae51/attachment.bin>


More information about the cfe-commits mailing list