This is an archive of the discontinued LLVM Phabricator instance.

[include-cleaner] Handle decls/refs to concepts.
ClosedPublic

Authored by usaxena95 on Aug 25 2023, 6:15 AM.

Details

Diff Detail

Event Timeline

usaxena95 created this revision.Aug 25 2023, 6:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2023, 6:15 AM
Herald added a subscriber: kadircet. · View Herald Transcript
usaxena95 requested review of this revision.Aug 25 2023, 6:16 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 25 2023, 6:16 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
usaxena95 edited the summary of this revision. (Show Details)Aug 25 2023, 6:28 AM

I think we're not *that* far away from landing the AST change, and changing RecursiveASTVisitor now is probably confusing and not worth the churn.
So I'd prefer to wait for now...

clang-tools-extra/include-cleaner/lib/WalkAST.cpp
249

after D155858 this can be VisitConceptReference

clang-tools-extra/include-cleaner/unittests/AnalysisTest.cpp
217

to complete the set I think you want

void foo(Bar auto x) (abbreviated template param) and Bar auto x = 1 (deduced type).

Though these may not pass yet

usaxena95 updated this revision to Diff 554955.Aug 31 2023, 3:11 AM
usaxena95 marked 2 inline comments as done.

Rebased over AST changes.

clang-tools-extra/include-cleaner/unittests/AnalysisTest.cpp
217

For some reason, Bar auto x = 1 is still failing; investigating.

sammccall added inline comments.Aug 31 2023, 3:21 AM
clang-tools-extra/include-cleaner/lib/WalkAST.cpp
244

I don't know why we're doing this, decls in general are not considered references to themselves.

Function/Var/Enum are in some cases, because their definition should be typechecked against a forward-declaration in the header. But that doesn't apply here: you can't forward-declare a concept.

clang-tools-extra/include-cleaner/unittests/AnalysisTest.cpp
201

AFAICT these are just normal AST nodes, so should be tested in WalkASTTest which is narrower and lighter-weight.

The tests in this file run a bit more code, and none of it seems specifically relevant to concepts.

usaxena95 updated this revision to Diff 554962.Aug 31 2023, 3:43 AM
usaxena95 marked 2 inline comments as done.

Addressed comments.

sammccall accepted this revision.Aug 31 2023, 4:35 AM

LGTM

Unclear to me whether the FIXME will be addressed by an AST bug or a local change, either way continuing to look into it SG but this is fine to land as-is.

This revision is now accepted and ready to land.Aug 31 2023, 4:35 AM