[PATCH] D95229: [clangd] Treat optional field type mismatches as soft failures

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 27 00:40:10 PST 2021


sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tools-extra/clangd/Protocol.cpp:837
     return false;
+  tryMap(Params, "triggerCharacter", R.triggerCharacter, P);
   R.triggerKind = static_cast<CompletionTriggerKind>(TriggerKind);
----------------
why are we no longer checking the value?


================
Comment at: clang-tools-extra/clangd/Protocol.cpp:33
+template <typename T>
+bool mapOptionalOrLog(llvm::json::ObjectMapper &O, llvm::StringLiteral Prop,
+                      T &Out) {
----------------
sammccall wrote:
> I would call this tryMap for brevity
Sorry... now that it can fail, I don't think `tryMap` is a great name anymore.

`mapOptOrNull`? `mapNullable`? 

up to you


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95229



More information about the cfe-commits mailing list