[PATCH] D116326: [CodeCompletion] Signature help for aggregate initialization.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 4 03:22:41 PST 2022


sammccall marked 11 inline comments as done.
sammccall added inline comments.


================
Comment at: clang/lib/Sema/CodeCompleteConsumer.cpp:568
+
+  if (const auto *FD = getFunction()) {
+    if (N < FD->param_size())
----------------
kadircet wrote:
> this doesn't cover the function(proto)type case
That's right. Function(Proto)Type doesn't contain decls for the parameters. Added a comment.


================
Comment at: clang/lib/Sema/SemaCodeComplete.cpp:6018
+//   after `S{.b=1,`      we want to suggest c to continue
+//   after `S{.b=1, 2,`   we continue with d (this is legal C and ext in C++)
+//
----------------
usaxena95 wrote:
> Can you also add detail for out-of-order designated initialisation.
> `S{.c=1, .b=2,`  (valid C, invalid C++, ext in C++)
> IIUC the current version would continue with `c` here. (reasoning: promoting in-order designated initialisation ?)
Added a comment

The reasoning is just that's the correct behavior :-)

```
struct S {int a,b; };
int m = (struct S){.b=1, .a=2, 3}.b;
// now m.a is 3
```



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116326



More information about the cfe-commits mailing list