[PATCH] D131696: [clangd] Fix an inlay-hint crash on a broken designator.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 12 05:37:14 PDT 2022


hokein added inline comments.


================
Comment at: clang-tools-extra/clangd/InlayHints.cpp:144
     });
-    if (llvm::isa<ImplicitValueInitExpr>(Init))
+    if (!Init || llvm::isa<ImplicitValueInitExpr>(Init))
       continue; // a "hole" for a subobject that was not explicitly initialized
----------------
kadircet wrote:
> nit: can you also update the comment to mention `broken initializer` (and maybe even a fixme to handle these, as in theory this is likely spelled in the code, but wasn't retained in the AST even as a `recoveryexpr`, hence we still have a place to attach the hint)
Done, updated the comment. I'd rather leave out the FIXME (it is unclear that we will address it).

The InitListExpr is tricky, the AST nodes is preserved in the syntactic form for InitListExpr (go-to-definition actually works on the broken initializer `A()` ), but here we're using the *semantic*-form...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131696



More information about the cfe-commits mailing list