[all-commits] [llvm/llvm-project] 73b2c8: [include-cleaner] Weaken signal for boosting prefe...

kadir çetinkaya via All-commits all-commits at lists.llvm.org
Wed Sep 6 05:49:30 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 73b2c86d95dc510d6972aaa4b44688aebebd89f1
      https://github.com/llvm/llvm-project/commit/73b2c86d95dc510d6972aaa4b44688aebebd89f1
  Author: Kadir Cetinkaya <kadircet at google.com>
  Date:   2023-09-06 (Wed, 06 Sep 2023)

  Changed paths:
    M clang-tools-extra/include-cleaner/lib/TypesInternal.h
    M clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp

  Log Message:
  -----------
  [include-cleaner] Weaken signal for boosting preferred headers

Putting preferred header signal above completeness implied we would
uprank forward declarations above complete ones in certain cases.

This can be desired in cases where:
- Complete definition is private. But this case is already governed by
  publicness signal.
- The library indeed intends to provide a forward declaring interface, like
  iosfwd vs ostream.

In all other cases, upranking is undesired as it means we've picked up prefered
headerness signal by mistake from an unrelated declaration to the library.

This change regresses the behavior for libraries that intentionally provide a
forward declaring interface. But that wasn't something we intended to support
explicitly, it was working incidentally when the forward declaring header had a
similar name to the symbol. Moreover, include-cleaner deliberately discourages
forward-declarations, so not working in this case is also more aligned with rest
of the components.

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




More information about the All-commits mailing list