This is an archive of the discontinued LLVM Phabricator instance.

[clang][Sema] Add CodeCompletionContext::CCC_ObjCClassForwardDecl
ClosedPublic

Authored by dgoldman on May 19 2023, 9:08 AM.

Details

Summary
  • Use this new context in Sema to limit completions to seen ObjC class names
  • Use this new context in clangd to disable include insertions when completing ObjC forward decls

Diff Detail

Event Timeline

dgoldman created this revision.May 19 2023, 9:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 19 2023, 9:08 AM
Herald added a subscriber: arphaman. · View Herald Transcript
dgoldman requested review of this revision.May 19 2023, 9:08 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 19 2023, 9:08 AM
kadircet added inline comments.Jun 21 2023, 1:02 AM
clang-tools-extra/clangd/CodeComplete.cpp
418

rather than doing this here, can you pass ContextKind into headerToInsertIfAllowed ? we already have some logic there that does something similar (e.g. check if there's a decl in the main file). it'd be nice to group them together, in case we want to extend this in the future. (it'd be great if we can just have a contextAllowsHeaderInsertion helper, which can only return true for ObjCClassForwardDecl for now).

dgoldman updated this revision to Diff 533969.Jun 23 2023, 8:05 AM
dgoldman marked an inline comment as done.

Add a contextAllowsHeaderInsertion helper to clangd

kadircet accepted this revision.Jun 27 2023, 8:13 AM

thanks

This revision is now accepted and ready to land.Jun 27 2023, 8:13 AM
This revision was landed with ongoing or failed builds.Jun 27 2023, 1:27 PM
This revision was automatically updated to reflect the committed changes.