[PATCH] D58340: [clang][Index] Visit UsingDecls and generate USRs for them

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 18 02:39:11 PST 2019


ilya-biryukov added inline comments.


================
Comment at: lib/Index/IndexDecl.cpp:588
                                          D->getLexicalDeclContext());
+    IndexCtx.handleDecl(D);
     for (const auto *I : D->shadows())
----------------
Any reason to add this to the middle of the function?
Could we move it to the end or to the start of the function instead? 

So that the function logically reads as 
```
visitDecl();
traverseSubdecls();
processReferences();
```


================
Comment at: lib/Index/USRGeneration.cpp:115
+    VisitDeclContext(D->getDeclContext());
+    Out << "@";
+
----------------
We need to add a unique tag character here, e.g. namespace aliases are tagged as `"@NA@"`, `"@UD@"` should be a good fit for using-decls.


================
Comment at: lib/Index/USRGeneration.cpp:118
+    if (EmitDeclName(D)) {
+      // The string can be empty if the declaration has no name; e.g., it is
+      // the ParmDecl with no name for declaration of a function pointer type,
----------------
This comment does not make sense for the using-decl, `ParmDecl` is not a using-decl.
If there are other cases where it may fail, let's put them into the comment.
If `EmitDeclName` should not fail for `UsingDecl`, let's add an assertion.


Repository:
  rC Clang

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

https://reviews.llvm.org/D58340





More information about the cfe-commits mailing list