[PATCH] D148552: [include-cleaner] Unify behaviour for static & instance members
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 17 23:52:17 PDT 2023
hokein accepted this revision.
hokein added inline comments.
This revision is now accepted and ready to land.
================
Comment at: clang-tools-extra/include-cleaner/lib/WalkAST.cpp:128
bool VisitDeclRefExpr(DeclRefExpr *DRE) {
- report(DRE->getLocation(), DRE->getFoundDecl());
+ if (DRE->getFoundDecl()->isCXXClassMember()) {
+ report(DRE->getLocation(), DRE->getQualifier()->getAsRecordDecl(),
----------------
We have two handled cases, it is not quite obvious to spot the difference between them. It would be nice to add a comment clarifying this is for accessing the static member instance.
================
Comment at: clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp:117
testWalk("namespace ns { int $explicit^x; }", "int y = ns::^x;");
- testWalk("struct S { static int $explicit^x; };", "int y = S::^x;");
+ testWalk("struct $implicit^S { static int x; };", "int y = S::^x;");
// Canonical declaration only.
----------------
can you add a testcase for static-member-call as well?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148552/new/
https://reviews.llvm.org/D148552
More information about the cfe-commits
mailing list