sammccall added inline comments.
================
Comment at: clang-tools-extra/clangd/XRefs.cpp:257
const NamedDecl *Def = getDefinition(D);
- const NamedDecl *Preferred = Def ? Def : D;
+ if (const NamedDecl *C = llvm::dyn_cast<NamedDecl>(D->getCanonicalDecl()))
+ D = C;
----------------
kadircet wrote:
> Is it possible for this check to ever fail? I think it is safe to just
> perform a `llvm::cast` instead of `dyn_cast`.
> also why not perform this before getting definition?
Done. (I thought there was such a case, but I was thinking about D vs OrigD in
IndexDataConusmer, and this happens in one of the rare cases where D isn't the
canonical decl of OrigD)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73369/new/
https://reviews.llvm.org/D73369
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits