[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
Thu Aug 29 05:12:05 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:

The connection between usedness and `!TD->getAsFunction()` wasn’t immediately obvious to me. With the newly-added comment, it's much clearer now, everything looks good, thanks.

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


More information about the cfe-commits mailing list