[PATCH] D139458: [clangd] Full support for #import insertions

David Goldman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 6 13:39:56 PST 2022


dgoldman created this revision.
Herald added subscribers: kadircet, arphaman, javed.absar.
Herald added a project: All.
dgoldman requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

These are still disabled by default, but will work in ObjC code if you
enable the `-import-insertions` flag.

This requires ASTSignals to be available; before ASTSignals are
available, we will always use #include. Once they are available, the
behavior varies as follows:

- For source files, use #import if the ObjC language flag is enabled
- For header files:
  - If the ObjC language flag is disabled, use #include
  - If the header file contains any #imports, use #import
  - If the header file references any ObjC decls, use #import
  - Otherwise, use #include


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139458

Files:
  clang-tools-extra/clangd/ASTSignals.cpp
  clang-tools-extra/clangd/ASTSignals.h
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/IncludeFixer.cpp
  clang-tools-extra/clangd/IncludeFixer.h
  clang-tools-extra/clangd/ParsedAST.cpp
  clang-tools-extra/clangd/ParsedAST.h
  clang-tools-extra/clangd/TUScheduler.cpp
  clang-tools-extra/clangd/tool/Check.cpp
  clang-tools-extra/clangd/unittests/ParsedASTTests.cpp
  clang-tools-extra/clangd/unittests/PreambleTests.cpp
  clang-tools-extra/clangd/unittests/TestTU.cpp
  clang-tools-extra/clangd/unittests/TestTU.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139458.480607.patch
Type: text/x-patch
Size: 18855 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221206/59b51982/attachment-0001.bin>


More information about the cfe-commits mailing list