[PATCH] D73101: [clangd] Do not duplicate TemplatedDecls in findExplicitReferences

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 21 06:48:57 PST 2020


hokein added inline comments.


================
Comment at: clang-tools-extra/clangd/FindTarget.cpp:584
+    void VisitRedeclarableTemplateDecl(const RedeclarableTemplateDecl *TD) {
+      // {Class,Function,Var,TypeAlias}TemplateDecls are visited as part of the
+      // NamedDecl below, we skip them here to not visit them twice.
----------------
the code this is correct right now (since {Class,Function,Var,TypeAlias}TemplateDecls  are the decls that derive from `RedeclarableTemplateDecl`), but I would do this in another way -- just add a filter in the VisitNamedDecl below, like


```
void VisitNamedDecl(const NamedDecl *ND) {
   ...
   if (ND is one of the  {Class,Function,Var,TypeAlias}TemplateDecls)
     return;
}
```


================
Comment at: clang-tools-extra/clangd/unittests/FindTargetTests.cpp:744
         "1: targets = {foo::Bar}, decl\n"
-        "2: targets = {foo::Bar}, decl\n"
-        "3: targets = {foo::Bar}\n"
----------------
nit: the diff seems not to be the one I have submitted, there should be a FIXME here which should be removed in this patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73101/new/

https://reviews.llvm.org/D73101





More information about the cfe-commits mailing list