[PATCH] D96058: [CodeComplete] Guess type for designated initializers
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 4 11:17:14 PST 2021
kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.
Thanks! LG with a small concern around possible effects on member completions for uninstantiated templates.
================
Comment at: clang/lib/Parse/ParseInit.cpp:163
+ DesignatorCompletionInfo DesignatorCompletion) {
+ if (!getPreprocessor().isCodeCompletionEnabled())
+ DesignatorCompletion.PreferredBaseType = QualType(); // skip field lookup
----------------
it might be nice to make the whole preferredtypebuilder a no-op on construction when codecompletion is disabled. but that can be an adventure for another day.
================
Comment at: clang/lib/Sema/SemaCodeComplete.cpp:4803
+ if (CTSD->getTemplateSpecializationKind() == TSK_Undeclared)
+ RD = CTSD->getSpecializedTemplate()->getTemplatedDecl();
+ }
----------------
i think this means we are going to offer completion for uninstantiated specializations using the primary template now (through `Sema::CodeCompleteMemberReferenceExpr`), which i am not sure is possible, but should be an improvement in either case.
but not having any tests (especially failing) makes me a little anxious.
================
Comment at: clang/lib/Sema/SemaCodeComplete.cpp:5790
+ if (const FieldDecl *FD = llvm::dyn_cast<FieldDecl>(Member))
+ NextType = FD->getType();
+ }
----------------
why don't we break after the first one ?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96058/new/
https://reviews.llvm.org/D96058
More information about the cfe-commits
mailing list