[PATCH] D66945: [clang-tidy] Fix a false positive in unused-using-decl check.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 3 07:04:22 PDT 2019
hokein added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp:105
}
// Mark using declarations as used by setting FoundDecls' value to zero. As
// the AST is walked in order, usages are only marked after a the
----------------
gribozavr wrote:
> Please move the comment below the lambda. The lambda is not doing what this comment says.
I think the comment is pretty old (it was added in the first patch, but the check has been evolved a lot). I updated the comment here.
================
Comment at: clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp:138
removeFromFoundDecls(RD);
+ } else if (Used->getKind() == TemplateArgument::Declaration) {
+ RemoveNamedDecl(Used->getAsDecl());
----------------
gribozavr wrote:
> Could you add a test for this case?
This is already covered by the existing test case `a.func2<int, ff>(t3);` -- in this patch, we change the matcher of `callExpr` on Line 63, and the callback of it now runs into this codepath (previously it falls into the `if (const auto *Used = Result.Nodes.getNodeAs<NamedDecl>("used")` branch above).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66945/new/
https://reviews.llvm.org/D66945
More information about the cfe-commits
mailing list