[PATCH] D128826: Go-to-type on smart_ptr<Foo> now also shows Foo
Tom Praschan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 29 11:45:03 PDT 2022
tom-anders added inline comments.
================
Comment at: clang-tools-extra/clangd/XRefs.cpp:1913
// to target.
-static QualType unwrapFindType(QualType T) {
+static llvm::SmallVector<QualType> unwrapFindType(
+ QualType T, const HeuristicResolver* H) {
----------------
tom-anders wrote:
> sammccall wrote:
> > Ergonomically I might prefer `void unwrapFindType(QualType, ..., vector<QualType>& Out)` or so.
> > This tends to compose a bit better IMO by making all the cases look similar whether you're adding one type or several or combining lists.
> >
> > You can still `return Out.push_back(T)` etc on a single line.
> Ah yes that makes sense. Didn't think about the `return Out.push_back(T)` trick to keep using early returns, thought I'd have to add a ton of `else if`s instead.
It makes the call side a bit uglier though - Is it okay to add a convenience wrapper `vector<QualType> unwrapFindType(QualType, HeuristicResolver*)` that forwards to the overload that uses the out-parameter?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128826/new/
https://reviews.llvm.org/D128826
More information about the cfe-commits
mailing list