[PATCH] D138219: [include-cleaner] Show includes matched by refs in HTML report.Demo: https://htmlpreview.github.io/?https://gist.githubusercontent.com/sam-mccall/ecee6869e37af3db28089b64d8dce806/raw/8736e64c45af411e2c2d72adaed2dfc4410a5b36/ASTTests.html%25202
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 23 01:06:27 PST 2022
hokein added a comment.
>> we are missing refs in some using declarations (line 31, line32), but line 33 does have a link which seems weird
>
> They are different types of symbol (template vs function), may make a difference?
You're right, the template is the reason here. Taking a closing look, the logic of in WalkAST.cpp <https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/include-cleaner/lib/WalkAST.cpp#L84> doesn't seem to handle well on this case.
E.g. for the following case, the `UsingShadowDecl` refers to the *primary* template decl, which is not marked as used or referenced. The used/referenced bit is only set for specialized `FunctionDecl`, so WalkAST doesn't report this UsingDecl location. (`EnumDecl` also has this problem).
namespace ns {
template<typename T>
int func();
}
using ns::func;
int k = func<int>();
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138219/new/
https://reviews.llvm.org/D138219
More information about the cfe-commits
mailing list