This is an archive of the discontinued LLVM Phabricator instance.

[include-cleaner] Make handling of enum constants similar to members
ClosedPublic

Authored by kadircet on Aug 22 2023, 7:18 AM.

Details

Summary

We were treating enum constants more like regular decls, which results
in ignoring type aliases/exports.
This patch brings the handling to be closer to member-like decls, with
one caveat. When we encounter reference to an enum constant we still
report an explicit reference to the particular enum constant, as
otherwise we might not see any references to the enum itself.

Diff Detail

Event Timeline

kadircet created this revision.Aug 22 2023, 7:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 22 2023, 7:18 AM
kadircet requested review of this revision.Aug 22 2023, 7:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 22 2023, 7:18 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
sammccall accepted this revision.Aug 22 2023, 8:48 AM
sammccall added inline comments.
clang-tools-extra/include-cleaner/lib/WalkAST.cpp
135

try to write a test case that relies on this :-)

clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
320

test using enum

This revision is now accepted and ready to land.Aug 22 2023, 8:48 AM
kadircet updated this revision to Diff 552391.Aug 22 2023, 8:56 AM
  • Add test for using enums
  • Drop implicit references from qualified names to their containers, as we should already have explicit references from the spelling of the qualifier.
kadircet updated this revision to Diff 552392.Aug 22 2023, 8:56 AM
  • Change to c++20
This revision was automatically updated to reflect the committed changes.
kadircet marked 2 inline comments as done.