[PATCH] D143319: [clangd] Support iwyu pragma: no_include

Younan Zhang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 4 05:30:06 PST 2023


zyounan created this revision.
Herald added subscribers: kadircet, arphaman.
Herald added a project: All.
zyounan updated this revision to Diff 494815.
zyounan added a comment.
zyounan updated this revision to Diff 494816.
zyounan added reviewers: hokein, sammccall, kadircet, nridge.
zyounan published this revision for review.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

Remove extra headers


zyounan added a comment.

Update test


This patch is one of the steps trying to optimize experience
of header insertion in code completion.
IWYU supports `no_include` pragma that helps user to get rid
of specified headers in main file.
The patch consists of two parts: Code completion part that
prevent auto insertion if the header to be inserted is under
the guard of `no_include` pragma. The other part is for include
cleaner, which emits diagnostic message pointing out that user
is including `no_include` headers.

A possible workaround for clangd/clangd#1481.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143319

Files:
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/Headers.cpp
  clang-tools-extra/clangd/Headers.h
  clang-tools-extra/clangd/IncludeCleaner.cpp
  clang-tools-extra/clangd/IncludeCleaner.h
  clang-tools-extra/clangd/ParsedAST.cpp
  clang-tools-extra/clangd/index/CanonicalIncludes.h
  clang-tools-extra/clangd/unittests/HeadersTests.cpp
  clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143319.494816.patch
Type: text/x-patch
Size: 15114 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230204/13e61efd/attachment-0001.bin>


More information about the cfe-commits mailing list