[PATCH] D155819: [include-cleaner] Loose matching for verbatim headers

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 20 05:23:28 PDT 2023


sammccall created this revision.
sammccall added a reviewer: kadircet.
Herald added a project: All.
sammccall requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

A verbatim header usually corresponds to a symbol from a header with
a pragma "IWYU pragma: private, include <foo.h>".

Currently this is only satisfied if the main file contains exactly

  #include <foo.h>

In practice this is too strict, we also want to allow

  #include "path/to/foo.h"

so long as they resolve to the same file.

We cannot be 100% sure without doing IO, and we're not willing to do
that, but we can detect the common cases based on paths.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155819

Files:
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Record.h
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h
  clang-tools-extra/include-cleaner/lib/Record.cpp
  clang-tools-extra/include-cleaner/lib/Types.cpp
  clang-tools-extra/include-cleaner/unittests/TypesTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155819.542442.patch
Type: text/x-patch
Size: 8812 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230720/6d42dbdb/attachment.bin>


More information about the cfe-commits mailing list