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

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 12 02:40:43 PDT 2022


kadircet added inline comments.


================
Comment at: clang-tools-extra/clangd/InlayHints.cpp:140
   for (const Expr *Init : Sem->inits()) {
+    if (!Init)
+      continue;
----------------
we should have this bail out after introducing the scope_exit below to make sure we skip the field.


================
Comment at: clang-tools-extra/clangd/unittests/InlayHintTests.cpp:1427
+      return {
+        .b = A(),
+      };
----------------
a better test would be

```
struct A{};
struct Foo {int a; int b;};
Foo f{A(), 1);
```
and make sure we still get the hints for `1` as `b`.


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