[PATCH] D84599: [clang-index] Use NamedDecl::getDeclName() instead of NamedDecl::printName in USRGenerator::EmitDeclName

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 3 02:46:25 PDT 2020


kadircet added a comment.

I can see how this can cause problems with current implementation, but I don't think the proposed solution in here is also solving these problems.

For example, `MSGuidDecl`'s DeclName is actually empty (it is the printName overload that makes it meaningful). Hence when generating the USR
for two guid decls coming from similar contexts (there are other factors like namespace etc.) the code might end up producing the same output for both.

Generating the same USR for two different symbols might mess up lots of functionality in clangd's (and possibly other tools') index. I am not aware of
all the signals going into the USR generation and what is the importance of Decl name itself, maybe there should be a `getUniqueName` which defaults to
getDeclName, and can be overloaded for cases like MSGuidDecl. But as mentioned I don't understand this code well enough to make any concrete
suggestions so I would wait for an input from other reviewers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84599



More information about the cfe-commits mailing list