[clang-tools-extra] [include-cleaner] Mark RecordDecls referenced in UsingDecls as explicit (PR #106430)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 28 12:20:39 PDT 2024


================
@@ -203,7 +203,7 @@ class ASTWalker : public RecursiveASTVisitor<ASTWalker> {
   bool VisitUsingDecl(UsingDecl *UD) {
     for (const auto *Shadow : UD->shadows()) {
       auto *TD = Shadow->getTargetDecl();
-      auto IsUsed = TD->isUsed() || TD->isReferenced();
+      auto IsUsed = TD->isUsed() || TD->isReferenced() || !TD->getAsFunction();
----------------
hokein wrote:

nit: the name `IsUsed` no longer reflects its purpose. Consider renaming it to something more suitable or inlining it.

Additionally, it would be helpful to add comments to document the intention behind this code.

https://github.com/llvm/llvm-project/pull/106430


More information about the cfe-commits mailing list