[all-commits] [llvm/llvm-project] 16b5e1: [include-cleaner] Loose matching for verbatim headers

Sam McCall via All-commits all-commits at lists.llvm.org
Thu Jul 27 09:19:40 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 16b5e1897b7efaa4250b04dface0c807a02ae31a
      https://github.com/llvm/llvm-project/commit/16b5e1897b7efaa4250b04dface0c807a02ae31a
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2023-07-27 (Thu, 27 Jul 2023)

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

  Log Message:
  -----------
  [include-cleaner] Loose matching for verbatim headers

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.

Differential Revision: https://reviews.llvm.org/D155819




More information about the All-commits mailing list