[PATCH] D51917: [CodeCompletion] Enable signature help when initializing class/struct/union members.

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 11 02:43:13 PDT 2018


ilya-biryukov added inline comments.


================
Comment at: include/clang/Sema/Sema.h:10798
 
+ValueDecl *tryGetMember(CXXRecordDecl *ClassDecl, CXXScopeSpec &SS,
+                        ParsedType TemplateTypeTy,
----------------
The name is very generic, but the helper is only applicable to our specific case (looking up ctor member initializer). Maybe choose a different name?
Something like `tryLookupCtorInitMemberDecl` would be closer to what it actually does.


================
Comment at: lib/Parse/ParseDeclCXX.cpp:3471
+    auto SignatureHelpCaller = [&] {
+      if (CalledSignatureHelp)
+        return;
----------------
We're calling completion in other instances, this gives us valuable information (preferred type).
Why not do the same in this case?


================
Comment at: lib/Parse/ParseDeclCXX.cpp:3473
+        return;
+      CXXConstructorDecl *Constructor =
+          dyn_cast<CXXConstructorDecl>(ConstructorDecl);
----------------
That's a lot of code in parser.

We could probably extract this as a helper in Sema (similar to `ProduceConstructorSignatureHelp`) to follow the same pattern that we have for all the other signature help calls.
Would keep the parser simpler and, as an added benefit, would allow to make `tryGetMember` helper private (as it should be).
WDYT?


Repository:
  rC Clang

https://reviews.llvm.org/D51917





More information about the cfe-commits mailing list