[PATCH] D73271: [clang][CodeComplete] Support for designated initializers
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 23 09:30:02 PST 2020
sammccall added a comment.
oops, needs some more tests.
================
Comment at: clang/lib/Parse/ParseDecl.cpp:2463
+ PreferredType.enterVariableInit(Tok.getLocation(), ThisDecl);
ExprResult Init(ParseBraceInitializer());
----------------
oops, I missed where this was happening.
There are lots of non-vardecl cases where we might use a designated init.
We won't necessarily know the type in all of them, but it'd be good to at least cover the cases where we do. (Particularly `ty{...}`)
================
Comment at: clang/lib/Parse/ParseInit.cpp:162
+ExprResult Parser::ParseInitializerWithPotentialDesignator(
+ llvm::function_ref<void(const Designation &)> CodeCompleteCB) {
----------------
This callback stuff doesn't seem so idiomatic in the parser from what I've seen - can we be a bit more direct and just pass the location?
================
Comment at: clang/lib/Sema/SemaCodeComplete.cpp:4731
+static RecordDecl *getAsRecordDecl(const QualType BaseType) {
+ if (const RecordType *Record = BaseType->getAs<RecordType>())
----------------
sammccall wrote:
> this needs a name and/or comment to describe how it falls back to the primary template if the decl for the specialization isn't known.
> (From the name, you can't tel how it's different from Type::getRecordDecl)
as discussed offline, this doesn't handle null, neither does the new caller
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73271/new/
https://reviews.llvm.org/D73271
More information about the cfe-commits
mailing list