This is an archive of the discontinued LLVM Phabricator instance.

[clang][CodeComplete] Support for designated initializers
ClosedPublic

Authored by kadircet on Jan 23 2020, 6:33 AM.

Diff Detail

Event Timeline

kadircet created this revision.Jan 23 2020, 6:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 23 2020, 6:33 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Unit tests: pass. 62138 tests passed, 0 failed and 808 were skipped.

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

sammccall accepted this revision.Jan 23 2020, 7:03 AM

Nit: maybe mention "top-level" in the patch?

clang/lib/Sema/SemaCodeComplete.cpp
4731

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)

4735

this is handled by BaseType->getAsRecordDecl()

This revision is now accepted and ready to land.Jan 23 2020, 7:03 AM

oops, needs some more tests.

clang/lib/Parse/ParseDecl.cpp
2463

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{...})

clang/lib/Parse/ParseInit.cpp
162

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?

clang/lib/Sema/SemaCodeComplete.cpp
4731

as discussed offline, this doesn't handle null, neither does the new caller

kadircet updated this revision to Diff 240551.Jan 27 2020, 6:21 AM
kadircet marked 7 inline comments as done.
  • Propogate types in more cases
  • Add more tests
kadircet marked 7 inline comments as done.Jan 27 2020, 6:21 AM
kadircet added inline comments.
clang/lib/Parse/ParseDecl.cpp
2463

see tests for more cases we handle

clang/lib/Parse/ParseInit.cpp
162

it is not just the location though, we are also lacking the information regarding initializers seen so far. there are other occurrences of this callback mechanisms while parsing parenthesized expressions, for similar reasons, lacking the bigger picture. I think it is better to keep those element parsing functions unaware of the outer state, since they mostly don't care or depend on it.

clang/lib/Sema/SemaCodeComplete.cpp
4731

handling it in the new caller instead, as discussed previous caller technically can't have an incomplete type when it reaches this code path.

Unit tests: fail. 62159 tests passed, 5 failed and 811 were skipped.

failed: libc++.std/language_support/cmp/cmp_partialord/partialord.pass.cpp
failed: libc++.std/language_support/cmp/cmp_strongeq/cmp.strongeq.pass.cpp
failed: libc++.std/language_support/cmp/cmp_strongord/strongord.pass.cpp
failed: libc++.std/language_support/cmp/cmp_weakeq/cmp.weakeq.pass.cpp
failed: libc++.std/language_support/cmp/cmp_weakord/weakord.pass.cpp

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

sammccall accepted this revision.Jan 28 2020, 7:05 AM
This revision was automatically updated to reflect the committed changes.
kadircet marked 2 inline comments as done.