This is an archive of the discontinued LLVM Phabricator instance.

[include-cleaner] Weaken signal for boosting preferred headers
ClosedPublic

Authored by kadircet on Sep 5 2023, 12:47 AM.

Details

Summary

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.

Diff Detail

Event Timeline

kadircet created this revision.Sep 5 2023, 12:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 5 2023, 12:47 AM
kadircet requested review of this revision.Sep 5 2023, 12:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 5 2023, 12:47 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
sammccall accepted this revision.Sep 6 2023, 5:28 AM
This revision is now accepted and ready to land.Sep 6 2023, 5:28 AM