sammccall added a comment.

OK, sounds like we have something to move forward with. I'd suggest we start 
with an operation returning {SymbolID, scope qualifiers, unqualified name, USR} 
and ignoring location for now, unless you have an immediate need. Reason being 
this sidesteps the index question, what the semantics of the location are, 
which redecl to use etc. Hmm, this looks a lot like `SymbolInformation` as used 
by `textDocument/documentSymbol` with a USR extension. We could consider 
reusing that type...

> A declaration in this case is perfectly fine. You can leverage existing code 
> like clang::tooling::getNamedDeclAt that will return the declaration for a 
> location, and that's used by things like clang-rename.

I'd suggest putting this operation in XRefs.cpp and reusing 
`getSymbolAtPosition`, because that's consistent with how we handle other 
"symbol at cursor" operations, and is aware of our preamble handling. If the 
implementation can be improved or reuse other libraries that's a good idea, but 
it should be uniform.
(getNamedDeclAt looks simpler/cleaner, but I assume you want this to work when 
the cursor is on a reference rather than a decl? If I'm reading getNamedDeclAt 
correctly, it doesn't seem to handle that).


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D54529



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to