sammccall marked an inline comment as done.
sammccall added inline comments.


================
Comment at: clang-tools-extra/clangd/JSONTransport.cpp:28
+          [&](const CancelledError &C) -> llvm::Error {
+            switch (C.Reason) {
+              case static_cast<int>(ErrorCode::ContentModified):
----------------
kadircet wrote:
> Maybe `static_cast<ErrorCode>(C.Reason)` instead of casting cases.
> 
> I know the reason is not necessarily LSP specific, but we seem to be 
> defaulting to `ErrorCode::RequestCancelled` anyways.
Sadly this is UB if the value isn't an element of the enum (or in its range, or 
something). Whereas casting the cases leaves the code valid for arbitrary 
integers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77947



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

Reply via email to