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

Utkarsh Saxena via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 3 23:51:38 PST 2022


usaxena95 added inline comments.


================
Comment at: clang/lib/Sema/SemaCodeComplete.cpp:3699
+  unsigned ChunkIndex = 0;
+  auto AddChunk = [&](std::string Placeholder) {
+    if (ChunkIndex > 0)
----------------
nit: const ref.


================
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++)
+//
----------------
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 ?)


================
Comment at: clang/lib/Sema/SemaCodeComplete.cpp:6056
+  // (Probing getParamDecl() directly would be quadratic in number of fields).
+  unsigned AggregateSize = Aggregate.getNumParams();
+  unsigned DesignatedIndex = 0;
----------------
nit: move closer to usage below.


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